
package server;


import client.MapleCharacter;
import client.MapleTraitType;
import client.VMatrixOptionBans;
import client.inventory.*;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.fasterxml.jackson.databind.ObjectMapper;
import configs.CubeConfig;
import configs.SealedConfig;
import configs.ServerConfig;
import constants.ItemConstants;
import constants.JobConstants;
import database.DatabaseConnection;
import handling.channel.handler.EnchantHandler;
import handling.opcode.SendPacketOpcode;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import provider.*;
import tools.*;
import tools.config.BmsSerUtil;
import tools.data.output.MaplePacketLittleEndianWriter;
import tools.packet.PacketHelper;

import java.awt.*;
import java.io.File;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.List;

 public class MapleItemInformationProvider {
    /*   42 */   private static final Logger log = LogManager.getLogger(MapleItemInformationProvider.class.getName());
    /*   43 */   private static final MapleItemInformationProvider instance = new MapleItemInformationProvider();
    /*   44 */   protected final MapleDataProvider chrData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Character.wz"));
    /*   45 */   protected final MapleDataProvider etcData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Etc.wz"));
    /*   46 */   protected final MapleDataProvider itemData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Item.wz"));
    /*   47 */   protected final MapleDataProvider stringData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/String.wz"));
    /*   48 */   protected final MapleDataProvider effectData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Effect.wz"));
    /*   49 */   protected final MapleDataProvider uiData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/UI.wz"));
    /*   50 */   protected final Map<Integer, StructFamiliar> familiars = new HashMap<>();
    /*   51 */   protected final Map<Integer, LinkedList<StructItemOption>> familiar_option = new HashMap<>();
    /*   52 */   protected final Map<Integer, Map<Integer, Float>> familiarTable_pad = new HashMap<>();
    /*   53 */   protected final Map<Integer, Map<Integer, Short>> familiarTable_rchance = new HashMap<>();
    /*   54 */   protected final Map<String, List<Triple<String, Point, Point>>> afterImage = new HashMap<>();
    /*   55 */   protected final Map<Integer, MapleStatEffect> itemEffects = new HashMap<>();
    /*   56 */   protected final Map<Integer, MapleStatEffect> itemEffectsEx = new HashMap<>();
    /*   57 */   protected final Map<Integer, Integer> mobIds = new HashMap<>();
    /*   58 */   protected final Map<Integer, Pair<Integer, Integer>> potLife = new HashMap<>();
    /*   59 */   protected final Map<Integer, StructAndroid> androidInfo = new HashMap<>();
    /*   60 */   protected final Map<Integer, StructCrossHunterShop> crossHunterShop = new HashMap<>();
    /*   61 */   protected final Map<Integer, Integer> exclusiveEquip = new HashMap<>();
    /*   62 */   protected final Map<Integer, StructExclusiveEquip> exclusiveEquipInfo = new HashMap<>();
    /*   63 */   protected final Map<Integer, Integer> soulSkill = new TreeMap<>();
    /*   64 */   protected final Map<Integer, ArrayList<Integer>> tempOption = new TreeMap<>();
    /*   65 */   protected final Map<Integer, Pair<Integer, Integer>> socketReqLevel = new TreeMap<>();
    /*   66 */   protected final Map<Integer, Integer> damageSkinBox = new TreeMap<>();
    /*   67 */   protected final List<Integer> setItemInfoEffs = new ArrayList<>();
    /*   68 */   protected final Map<Integer, Map<Integer, Triple<Integer, Integer, Integer>>> vcores = new HashMap<>();
    /*   69 */   protected final Map<Integer, VCoreDataEntry> vcoreDatas = new HashMap<>();
    /*   70 */   private final Map<String, List<VCoreDataEntry>> vcoreDatas_0 = new HashMap<>();
    /*   71 */   protected final Map<String, List<VCoreDataEntry>> vcoreDatas_s = new HashMap<>();
    /*   72 */   protected final Map<Integer, Map<Integer, List<Pair<String, Integer>>>> sealedEquipInfo = new TreeMap<>();
    /*   73 */   private final ObjectMapper mapper = JsonUtil.getMapperInstance();
    /*   74 */   private final Map<Integer, List<StructPetCapsule>> petCapsules = new HashMap<>();

    /*   76 */   private final Map<Integer, Map<Integer, StructItemOption>> allSocketItem = new HashMap<>();
    /*   77 */   private final Map<Integer, List<StructItemOption>> allItemOptions = new HashMap<>();
    /*   78 */   private final Map<Integer, StructSetItem> allStructSetItems = new HashMap<>();

    /*   80 */   private final Set<Integer> allHairFaceID = new HashSet<>();
    /*   81 */   private final Map<Integer, Map<Object, Object>> allItemData = new HashMap<>();
    /*   82 */   private final Map<Integer, String> allitemName = new HashMap<>();
    /*   83 */   private final Map<Integer, String> allitemDesc = new HashMap<>();
    /*   84 */   private final Map<Integer, String> allitemMsg = new HashMap<>();



    public static MapleItemInformationProvider getInstance() {
        /*   87 */
        return instance;

    }



    public List<Integer> getSetItemInfoEffs() {
        /*   91 */
        return this.setItemInfoEffs;

    }



    public void runEtc() {
        /*   95 */
        loadAndroid();
        /*   96 */
        loadCrossHunterChapter();
        /*   97 */
        loadItemPotLifeInfo();
        /*   98 */
        loadAfterImage();
        /*   99 */
        loadExclusiveEquip();









        /*  109 */
        loadFamiliar();

        /*  111 */
        loadFamiliarTable();

        /*  113 */
        loadDamageSkin();

        /*  115 */
        loadPetCapsules();

        /*  117 */
        loadSetItemInfoEff();

        /*  119 */
        loadVCore();

    }






    public void loadAndroid() {
        /*  126 */
        MapleDataDirectoryEntry e = (MapleDataDirectoryEntry) this.etcData.getRoot().getEntry("Android");
        /*  127 */
        for (MapleDataEntry d : e.getFiles()) {
            /*  128 */
            MapleData iz = this.etcData.getData("Android/" + d.getName());
            /*  129 */
            StructAndroid android = new StructAndroid();
            /*  130 */
            int type = Integer.parseInt(d.getName().substring(0, 4));
            /*  131 */
            android.type = type;
            /*  132 */
            android.gender = MapleDataTool.getIntConvert("info/gender", iz, 0);
            /*  133 */
            for (MapleData ds : iz.getChildByPath("costume/skin")) {
                /*  134 */
                android.skin.add(Integer.valueOf(MapleDataTool.getInt(ds, 2000)));

            }
            /*  136 */
            for (MapleData ds : iz.getChildByPath("costume/hair")) {
                /*  137 */
                android.hair.add(Integer.valueOf(MapleDataTool.getInt(ds, (android.gender == 0) ? 20101 : 21101)));

            }
            /*  139 */
            for (MapleData ds : iz.getChildByPath("costume/face")) {
                /*  140 */
                android.face.add(Integer.valueOf(MapleDataTool.getInt(ds, (android.gender == 0) ? 30110 : 31510)));

            }
            /*  142 */
            this.androidInfo.put(Integer.valueOf(type), android);

        }

    }






    public void loadCrossHunterChapter() {
        /*  150 */
        MapleData shopData = this.etcData.getData("CrossHunterChapter.img").getChildByPath("Shop");
        /*  151 */
        for (MapleData dat : shopData) {
            /*  152 */
            int key = Integer.parseInt(dat.getName());
            /*  153 */
            StructCrossHunterShop shop = new StructCrossHunterShop(MapleDataTool.getIntConvert("itemId", dat, 0), MapleDataTool.getIntConvert("tokenPrice", dat, -1), MapleDataTool.getIntConvert("potentialGrade", dat, 0));
            /*  154 */
            this.crossHunterShop.put(Integer.valueOf(key), shop);

        }

    }



    public void loadAfterImage() {
        /*  159 */
        List<Triple<String, Point, Point>> thePointK = new ArrayList<>();
        /*  160 */
        List<Triple<String, Point, Point>> thePointA = new ArrayList<>();

        /*  162 */
        MapleDataDirectoryEntry a = (MapleDataDirectoryEntry) this.chrData.getRoot().getEntry("Afterimage");
        /*  163 */
        for (MapleDataEntry b : a.getFiles()) {
            /*  164 */
            MapleData iz = this.chrData.getData("Afterimage/" + b.getName());
            /*  165 */
            List<Triple<String, Point, Point>> thePoint = new ArrayList<>();
            /*  166 */
            Map<String, Pair<Point, Point>> dummy = new HashMap<>();
            /*  167 */
            for (MapleData i : iz) {
                /*  168 */
                for (MapleData xD : i) {
                    /*  169 */
                    if (xD.getName().contains("prone") || xD.getName().contains("double") || xD.getName().contains("triple")) {

                        continue;

                    }
                    /*  172 */
                    if ((b.getName().contains("bow") || b.getName().contains("Bow")) && !xD.getName().contains("shoot")) {

                        continue;

                    }
                    /*  175 */
                    if ((b.getName().contains("gun") || b.getName().contains("cannon")) && !xD.getName().contains("shot")) {

                        continue;

                    }
                    /*  178 */
                    if (dummy.containsKey(xD.getName())) {
                        /*  179 */
                        if (xD.getChildByPath("lt") != null) {
                            /*  180 */
                            Point point1 = (Point) xD.getChildByPath("lt").getData();
                            /*  181 */
                            Point ourLt = (Point) ((Pair) dummy.get(xD.getName())).left;
                            /*  182 */
                            if (point1.x < ourLt.x) {
                                /*  183 */
                                ourLt.x = point1.x;

                            }
                            /*  185 */
                            if (point1.y < ourLt.y) {
                                /*  186 */
                                ourLt.y = point1.y;

                            }

                        }
                        /*  189 */
                        if (xD.getChildByPath("rb") != null) {
                            /*  190 */
                            Point point1 = (Point) xD.getChildByPath("rb").getData();
                            /*  191 */
                            Point ourRb = (Point) ((Pair) dummy.get(xD.getName())).right;
                            /*  192 */
                            if (point1.x > ourRb.x) {
                                /*  193 */
                                ourRb.x = point1.x;

                            }
                            /*  195 */
                            if (point1.y > ourRb.y)
                                /*  196 */ ourRb.y = point1.y;

                        }

                        continue;

                    }
                    /*  200 */
                    Point lt = null, rb = null;
                    /*  201 */
                    if (xD.getChildByPath("lt") != null) {
                        /*  202 */
                        lt = (Point) xD.getChildByPath("lt").getData();

                    }
                    /*  204 */
                    if (xD.getChildByPath("rb") != null) {
                        /*  205 */
                        rb = (Point) xD.getChildByPath("rb").getData();

                    }
                    /*  207 */
                    dummy.put(xD.getName(), new Pair(lt, rb));

                }

            }

            /*  211 */
            for (Map.Entry<String, Pair<Point, Point>> ez : dummy.entrySet()) {
                /*  212 */
                if (((String) ez.getKey()).length() > 2 && ((String) ez.getKey()).substring(((String) ez.getKey()).length() - 2, ((String) ez.getKey()).length() - 1).equals("D")) {
                    /*  213 */
                    thePointK.add(new Triple(ez.getKey(), ((Pair) ez.getValue()).left, ((Pair) ez.getValue()).right));
                    continue;
                    /*  214 */
                }
                if (((String) ez.getKey()).contains("PoleArm")) {
                    /*  215 */
                    thePointA.add(new Triple(ez.getKey(), ((Pair) ez.getValue()).left, ((Pair) ez.getValue()).right));
                    continue;

                }
                /*  217 */
                thePoint.add(new Triple(ez.getKey(), ((Pair) ez.getValue()).left, ((Pair) ez.getValue()).right));

            }

            /*  220 */
            this.afterImage.put(b.getName().substring(0, b.getName().length() - 4), thePoint);

        }
        /*  222 */
        this.afterImage.put("katara", thePointK);
        /*  223 */
        this.afterImage.put("aran", thePointA);

    }






    public void loadItemPotLifeInfo() {
        /*  230 */
        MapleData lifesData = this.etcData.getData("ItemPotLifeInfo.img");
        /*  231 */
        for (MapleData d : lifesData) {
            /*  232 */
            if (d.getChildByPath("info") != null && MapleDataTool.getInt("type", d.getChildByPath("info"), 0) == 1) {
                /*  233 */
                this.potLife.put(Integer.valueOf(MapleDataTool.getInt("counsumeItem", d.getChildByPath("info"), 0)), new Pair(Integer.valueOf(Integer.parseInt(d.getName())), Integer.valueOf(d.getChildByPath("level").getChildren().size())));

            }

        }

    }






    public void loadExclusiveEquip() {
        /*  242 */
        MapleData exclusiveEquipData = this.etcData.getData("ExclusiveEquip.img");


        /*  245 */
        for (MapleData dat : exclusiveEquipData) {
            /*  246 */
            StructExclusiveEquip structExclusiveEquip = new StructExclusiveEquip();
            /*  247 */
            int j = Integer.parseInt(dat.getName());
            /*  248 */
            String msg = MapleDataTool.getString("msg", dat, "");
            /*  249 */
            msg = msg.replace("\\r\\n", "\r\n");
            /*  250 */
            msg = msg.replace("-------<", "---<");
            /*  251 */
            msg = msg.replace(">------", ">---");
            /*  252 */
            structExclusiveEquip.id = j;
            /*  253 */
            structExclusiveEquip.msg = msg;
            /*  254 */
            for (MapleData level : dat.getChildByPath("item")) {
                /*  255 */
                int itemId = MapleDataTool.getInt(level);
                /*  256 */
                structExclusiveEquip.itemIDs.add(Integer.valueOf(itemId));
                /*  257 */
                this.exclusiveEquip.put(Integer.valueOf(itemId), Integer.valueOf(j));

            }
            /*  259 */
            this.exclusiveEquipInfo.put(Integer.valueOf(j), structExclusiveEquip);

        }

        /*  262 */
        StructExclusiveEquip exclusive = new StructExclusiveEquip();
        /*  263 */
        int exId = 100;
        /*  264 */
        exclusive.msg = "只能佩戴一个\r\n老公老婆的戒指。";
        int i;
        /*  265 */
        for (i = 1112446; i <= 1112495; i++) {
            /*  266 */
            exclusive.itemIDs.add(Integer.valueOf(i));
            /*  267 */
            this.exclusiveEquip.put(Integer.valueOf(i), Integer.valueOf(exId));

        }
        /*  269 */
        this.exclusiveEquipInfo.put(Integer.valueOf(exId), exclusive);

        /*  271 */
        exclusive = new StructExclusiveEquip();
        /*  272 */
        exId = 101;
        /*  273 */
        exclusive.msg = "只能佩戴一个\r\n不速之客的戒指。";
        /*  274 */
        for (i = 1112435; i <= 1112439; i++) {
            /*  275 */
            exclusive.itemIDs.add(Integer.valueOf(i));
            /*  276 */
            this.exclusiveEquip.put(Integer.valueOf(i), Integer.valueOf(exId));

        }
        /*  278 */
        this.exclusiveEquipInfo.put(Integer.valueOf(exId), exclusive);

        /*  280 */
        exclusive = new StructExclusiveEquip();
        /*  281 */
        exId = 102;
        /*  282 */
        exclusive.msg = "只能佩戴一个\r\n十字旅团的戒指。";
        /*  283 */
        for (i = 1112599; i <= 1112613; i++) {
            /*  284 */
            exclusive.itemIDs.add(Integer.valueOf(i));
            /*  285 */
            this.exclusiveEquip.put(Integer.valueOf(i), Integer.valueOf(exId));

        }
        /*  287 */
        this.exclusiveEquipInfo.put(Integer.valueOf(exId), exclusive);

    }






    public void loadFamiliar() {
        /*  294 */
        MapleDataDirectoryEntry f = (MapleDataDirectoryEntry) this.chrData.getRoot().getEntry("Familiar");
        /*  295 */
        MapleData familiarItemData = this.itemData.getData("Consume/0287.img");
        /*  296 */
        for (MapleDataEntry d : f.getFiles()) {
            /*  297 */
            int id = Integer.parseInt(d.getName().substring(0, d.getName().length() - 4));
            /*  298 */
            for (MapleData info : this.chrData.getData("Familiar/" + d.getName())) {
                /*  299 */
                if (info.getName().equals("info")) {
                    /*  300 */
                    int skillid = MapleDataTool.getIntConvert("skill/id", info, 0);
                    /*  301 */
                    int effectAfter = MapleDataTool.getIntConvert("skill/effectAfter", info, 0);
                    /*  302 */
                    int mobid = MapleDataTool.getIntConvert("MobID", info, 0);
                    /*  303 */
                    int monsterCardID = MapleDataTool.getIntConvert("monsterCardID", info, 0);
                    /*  304 */
                    byte grade = (byte) MapleDataTool.getIntConvert("0" + monsterCardID + "/info/grade", familiarItemData, 0);
                    /*  305 */
                    this.familiars.put(Integer.valueOf(id), new StructFamiliar(id, skillid, effectAfter, mobid, monsterCardID, grade));

                }

            }

        }

    }



    public void loadFamiliarTable() {
        /*  312 */
        MapleData familiarTableData = this.etcData.getData("FamiliarTable.img");
        /*  313 */
        for (MapleData d : familiarTableData) {
            /*  314 */
            if (d.getName().equals("stat")) {
                /*  315 */
                for (MapleData subd : d) {
                    /*  316 */
                    Map<Integer, Float> stats = new HashMap<>();
                    /*  317 */
                    for (MapleData stat : subd) {
                        /*  318 */
                        stats.put(Integer.valueOf(stat.getName()), Float.valueOf(MapleDataTool.getFloat(stat.getChildByPath("pad"), 0.0F)));

                    }
                    /*  320 */
                    this.familiarTable_pad.put(Integer.valueOf(subd.getName()), stats);

                }
                continue;
                /*  322 */
            }
            if (d.getName().equals("reinforce_chance")) {
                /*  323 */
                for (MapleData subd : d) {
                    /*  324 */
                    Map<Integer, Short> chances = new HashMap<>();
                    /*  325 */
                    for (MapleData chance : subd) {
                        /*  326 */
                        chances.put(Integer.valueOf(chance.getName()), (Short) chance.getData());

                    }
                    /*  328 */
                    this.familiarTable_rchance.put(Integer.valueOf(subd.getName()), chances);

                }

            }

        }

    }

















    public void loadDamageSkin() {
        /*  349 */
        try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
            /*  350 */
            PreparedStatement ps = con.prepareStatement("SELECT  * FROM `damageskin`");
            /*  351 */
            ResultSet rs = ps.executeQuery();
            /*  352 */
            while (rs.next()) {
                /*  353 */
                int id = rs.getInt("id");
                /*  354 */
                int itemid = rs.getInt("itemid");
                /*  355 */
                if (itemid > 0) {
                    /*  356 */
                    this.damageSkinBox.put(Integer.valueOf(itemid), Integer.valueOf(id));

                }

            }
            /*  359 */
        } catch (SQLException e) {
            /*  360 */
            log.error("ERROR loadDamageSkin", e);

        }

    }



    public void loadSetItemInfoEff() {
        /*  365 */
        this.effectData.getData("SetItemInfoEff.img").forEach(mapleData -> this.setItemInfoEffs.add(Integer.valueOf(mapleData.getName())));
        /*  366 */
        Collections.reverse(this.setItemInfoEffs);

    }



    public void loadVCore() {
        /*  370 */
        MapleData vmatrixData = this.etcData.getData("VMatrixOption.img");
        /*  371 */
        if (vmatrixData != null) {
            /*  372 */
            MapleData w = vmatrixData.getChildByPath("info");
            /*  373 */
            if (w != null) {
                /*  374 */
                VMatrixOptionBans.INSTANCE.setSlotMax(MapleDataTool.getInt("slotMax", w, 500));
                /*  375 */
                VMatrixOptionBans.INSTANCE.setEquipSlotMin(MapleDataTool.getInt("equipSlotMin", w, 4));
                /*  376 */
                VMatrixOptionBans.INSTANCE.setEquipSlotMax(MapleDataTool.getInt("equipSlotMax", w, 14));
                /*  377 */
                VMatrixOptionBans.INSTANCE.setSpecialSlotMax(MapleDataTool.getInt("specialSlotMax", w, 1));
                /*  378 */
                VMatrixOptionBans.INSTANCE.setExtendLevel(MapleDataTool.getInt("extendLevel", w, 5));
                /*  379 */
                VMatrixOptionBans.INSTANCE.setExtendAF(MapleDataTool.getInt("extendAF", w, 0));
                /*  380 */
                VMatrixOptionBans.INSTANCE.setGradeMax(MapleDataTool.getInt("gradeMax", w, 25));
                /*  381 */
                VMatrixOptionBans.INSTANCE.setTotalGradeMax(MapleDataTool.getInt("totalGradeMax", w, 50));
                /*  382 */
                VMatrixOptionBans.INSTANCE.setCraftSkillCoreCost(MapleDataTool.getInt("craftSkillCoreCost", w, 140));
                /*  383 */
                VMatrixOptionBans.INSTANCE.setCraftEnchantCoreCost(MapleDataTool.getInt("craftEnchantCoreCost", w, 70));
                /*  384 */
                VMatrixOptionBans.INSTANCE.setCraftSpecialCoreCost(MapleDataTool.getInt("craftSpecialCoreCost", w, 250));
                /*  385 */
                VMatrixOptionBans.INSTANCE.setCraftGemstoneCost(MapleDataTool.getInt("craftGemstoneCost", w, 35));
                /*  386 */
                VMatrixOptionBans.INSTANCE.setMatrixPointResetMeso(MapleDataTool.getInt("matrixPointResetMeso", w, 1000000));
                /*  387 */
                VMatrixOptionBans.INSTANCE.setEquipSlotEnhanceMax(MapleDataTool.getInt("equipSlotEnhanceMax", w, 5));

            }
            /*  389 */
            MapleData w2 = vmatrixData.getChildByPath("slotExpansionMeso");
            /*  390 */
            if (w2 != null) {
                /*  391 */
                for (MapleData data : w2) {
                    /*  392 */
                    int name = Integer.parseInt(data.getName());
                    /*  393 */
                    HashMap<Integer, Integer> map = new HashMap<>();
                    /*  394 */
                    for (MapleData datum : data) {
                        /*  395 */
                        if (datum.getType() == MapleDataType.INT ||datum.getType() == MapleDataType.LONG) {
                            map.put(Integer.valueOf(Integer.parseInt(datum.getName())), Integer.valueOf(MapleDataTool.getInt(datum, 278440000)));
                        }


                    }
                    /*  402 */
                    VMatrixOptionBans.INSTANCE.getSlotExpansionMesos().put(Integer.valueOf(name), map);

                }

            }

        }

        /*  407 */
        MapleData vcoreData = this.etcData.getData("VCore.img");
        /*  408 */
        int vcoresindex = 0;
        /*  409 */
        for (MapleData enforcement : vcoreData.getChildByPath("Enforcement")) {
            /*  410 */
            HashMap<Integer, Triple<Integer, Integer, Integer>> map = new HashMap<>();
            /*  411 */
            for (MapleData subdata : enforcement) {
                /*  412 */
                map.put(Integer.valueOf(subdata.getName()), new Triple(Integer.valueOf(MapleDataTool.getInt("nextExp", subdata, 0)), Integer.valueOf(MapleDataTool.getInt("expEnforce", subdata, 0)), Integer.valueOf(MapleDataTool.getInt("extract", subdata, 0))));

            }
            /*  414 */
            this.vcores.put(Integer.valueOf(vcoresindex++), map);

        }
        /*  416 */
        for (MapleData coreData : vcoreData.getChildByPath("CoreData")) {
            /*  417 */
            VCoreDataEntry vCoreDataEntry = new VCoreDataEntry();
            /*  418 */
            vCoreDataEntry.setId(Integer.valueOf(coreData.getName()).intValue());
            /*  419 */
            vCoreDataEntry.setName(MapleDataTool.getString("name", coreData, ""));
            /*  420 */
            vCoreDataEntry.setDesc(MapleDataTool.getString("desc", coreData, ""));
            /*  421 */
            vCoreDataEntry.setType(MapleDataTool.getInt("type", coreData, 0));
            /*  422 */
            vCoreDataEntry.setMaxLevel(MapleDataTool.getInt("maxLevel", coreData, 0));
            /*  423 */
            vCoreDataEntry.setJob(MapleDataTool.getString("0", coreData.getChildByPath("job"), ""));
            /*  424 */
            if (!"none".equals(vCoreDataEntry.getJob()) &&
                    /*  425 */         coreData.getChildByPath("connectSkill") != null) {
                /*  426 */
                MapleData connectSkill1 = coreData.getChildByPath("connectSkill");
                /*  427 */
                if (connectSkill1 != null) {
                    /*  428 */
                    for (MapleData connectSkill : connectSkill1) {
                        /*  429 */
                        int anInt = MapleDataTool.getInt(connectSkill, 0);
                        /*  430 */
                        if (anInt > 0) {
                            /*  431 */
                            vCoreDataEntry.getConnectSkill().add(Integer.valueOf(anInt));

                        }

                    }

                }

            }

            /*  437 */
            this.vcoreDatas.put(Integer.valueOf(vCoreDataEntry.getId()), vCoreDataEntry);
            /*  438 */
            if (vCoreDataEntry.getType() == 0) {
                /*  439 */
                List<VCoreDataEntry> list = this.vcoreDatas_0.computeIfAbsent(vCoreDataEntry.getJob(), k -> new ArrayList());
                /*  440 */
                list.add(vCoreDataEntry);
                continue;
                /*  441 */
            }
            if (vCoreDataEntry.getType() == 1) {
                /*  442 */
                List<VCoreDataEntry> list = this.vcoreDatas_s.computeIfAbsent(vCoreDataEntry.getJob(), k -> new ArrayList());
                /*  443 */
                list.add(vCoreDataEntry);

            }

        }

    }



    public void loadPetCapsules() {
        /*  449 */
        for (MapleData training : this.itemData.getData("PetCapsule.img").getChildByPath("Training")) {
            /*  450 */
            LinkedList<StructPetCapsule> structPetCapsules = new LinkedList<>();
            /*  451 */
            for (MapleData effect : training.getChildByPath("effect")) {
                /*  452 */
                StructPetCapsule structPetCapsule = new StructPetCapsule();
                /*  453 */
                structPetCapsule.name = Integer.parseInt(effect.getName());
                /*  454 */
                structPetCapsule.desc = MapleDataTool.getString("desc_eff1", training, "");
                /*  455 */
                for (String type : StructPetCapsule.types) {
                    /*  456 */
                    int value = MapleDataTool.getInt(type, effect, 0);
                    /*  457 */
                    if (value > 0) {
                        /*  458 */
                        structPetCapsule.data.put(type, Integer.valueOf(value));

                    }

                }
                /*  461 */
                structPetCapsules.add(structPetCapsule);

            }
            /*  463 */
            this.petCapsules.put(Integer.valueOf(Integer.parseInt(training.getName())), structPetCapsules);

        }

    }






    public void loadSetItemData() {
        /*  471 */
        MapleData setsData = this.etcData.getData("SetItemInfo.img");


        /*  474 */
        for (MapleData dat : setsData) {
            /*  475 */
            StructSetItem SetItem = new StructSetItem();
            /*  476 */
            SetItem.setItemID = Integer.parseInt(dat.getName());
            /*  477 */
            SetItem.setItemName = MapleDataTool.getString("setItemName", dat, "");
            /*  478 */
            SetItem.completeCount = (byte) MapleDataTool.getIntConvert("completeCount", dat, 0);
            /*  479 */
            for (MapleData level : dat.getChildByPath("ItemID")) {
                /*  480 */
                if (level.getType() != MapleDataType.INT) {
                    /*  481 */
                    for (MapleData leve : level) {
                        /*  482 */
                        if (!leve.getName().equals("representName") && !leve.getName().equals("typeName"))
                             try {
                            /*  484 */
                            SetItem.itemIDs.add(Integer.valueOf(MapleDataTool.getIntConvert(leve)));
                            /*  485 */
                        } catch (Exception e) {
                            /*  486 */
                            System.err.println("出错数据： leve = " + leve.getData());

                        }

                    }

                    continue;

                }
                /*  491 */
                SetItem.itemIDs.add(Integer.valueOf(MapleDataTool.getInt(level)));

            }

            /*  494 */
            for (MapleData level : dat.getChildByPath("Effect")) {
                /*  495 */
                StructSetItemStat SetItemStat = new StructSetItemStat();
                /*  496 */
                SetItemStat.incSTR = MapleDataTool.getIntConvert("incSTR", level, 0);
                /*  497 */
                SetItemStat.incDEX = MapleDataTool.getIntConvert("incDEX", level, 0);
                /*  498 */
                SetItemStat.incINT = MapleDataTool.getIntConvert("incINT", level, 0);
                /*  499 */
                SetItemStat.incLUK = MapleDataTool.getIntConvert("incLUK", level, 0);
                /*  500 */
                SetItemStat.incMHP = MapleDataTool.getIntConvert("incMHP", level, 0);
                /*  501 */
                SetItemStat.incMMP = MapleDataTool.getIntConvert("incMMP", level, 0);
                /*  502 */
                SetItemStat.incMHPr = MapleDataTool.getIntConvert("incMHPr", level, 0);
                /*  503 */
                SetItemStat.incMMPr = MapleDataTool.getIntConvert("incMMPr", level, 0);
                /*  504 */
                SetItemStat.incACC = MapleDataTool.getIntConvert("incACC", level, 0);
                /*  505 */
                SetItemStat.incEVA = MapleDataTool.getIntConvert("incEVA", level, 0);
                /*  506 */
                SetItemStat.incPDD = MapleDataTool.getIntConvert("incPDD", level, 0);
                /*  507 */
                SetItemStat.incMDD = MapleDataTool.getIntConvert("incMDD", level, 0);
                /*  508 */
                SetItemStat.incPAD = MapleDataTool.getIntConvert("incPAD", level, 0);
                /*  509 */
                SetItemStat.incMAD = MapleDataTool.getIntConvert("incMAD", level, 0);
                /*  510 */
                SetItemStat.incJump = MapleDataTool.getIntConvert("incJump", level, 0);
                /*  511 */
                SetItemStat.incSpeed = MapleDataTool.getIntConvert("incSpeed", level, 0);
                /*  512 */
                SetItemStat.incAllStat = MapleDataTool.getIntConvert("incAllStat", level, 0);
                /*  513 */
                SetItemStat.incPQEXPr = MapleDataTool.getIntConvert("incPQEXPr", level, 0);
                /*  514 */
                SetItemStat.incPVPDamage = MapleDataTool.getIntConvert("incPVPDamage", level, 0);
                /*  515 */
                SetItemStat.option1 = MapleDataTool.getIntConvert("Option/1/option", level, 0);
                /*  516 */
                SetItemStat.option2 = MapleDataTool.getIntConvert("Option/2/option", level, 0);
                /*  517 */
                SetItemStat.option3 = MapleDataTool.getIntConvert("Option/3/option", level, 0);
                /*  518 */
                SetItemStat.option1Level = MapleDataTool.getIntConvert("Option/1/level", level, 0);
                /*  519 */
                SetItemStat.option2Level = MapleDataTool.getIntConvert("Option/2/level", level, 0);
                /*  520 */
                SetItemStat.option3Level = MapleDataTool.getIntConvert("Option/3/level", level, 0);
                /*  521 */
                SetItemStat.skillId = MapleDataTool.getIntConvert("activeSkill/0/id", level, 0);
                /*  522 */
                SetItemStat.skillLevel = MapleDataTool.getIntConvert("activeSkill/0/level", level, 0);
                /*  523 */
                SetItem.setItemStat.put(Integer.valueOf(Integer.parseInt(level.getName())), SetItemStat);

            }
            /*  525 */
            this.allStructSetItems.put(Integer.valueOf(SetItem.setItemID), SetItem);

        }

    }







    public void loadPotentialData() {
        /*  534 */
        MapleData potsData = this.itemData.getData("ItemOption.img");

        /*  536 */
        for (MapleData dat : potsData) {
            /*  537 */
            List<StructItemOption> items = new LinkedList<>();
            /*  538 */
            for (MapleData potLevel : dat.getChildByPath("level")) {
                /*  539 */
                StructItemOption item = new StructItemOption();
                /*  540 */
                item.opID = Integer.parseInt(dat.getName());
                /*  541 */
                item.optionType = MapleDataTool.getIntConvert("info/optionType", dat, 0);
                /*  542 */
                item.reqLevel = MapleDataTool.getIntConvert("info/reqLevel", dat, 0);
                /*  543 */
                item.opString = MapleDataTool.getString("info/string", dat, "");
                /*  544 */
                for (String i : StructItemOption.types) {
                    /*  545 */
                    if (i.equals("face")) {
                        /*  546 */
                        item.face = MapleDataTool.getString("face", potLevel, "");

                    } else {
                        /*  548 */
                        int level = MapleDataTool.getIntConvert(i, potLevel, 0);
                        /*  549 */
                        if (level > 0) {
                            /*  550 */
                            item.data.put(i, Integer.valueOf(level));

                        }

                    }

                }
                /*  554 */
                switch (item.opID) {

                    case 31001:

                    case 31002:

                    case 31003:

                    case 31004:
                        /*  559 */
                        item.data.put("skillID", Integer.valueOf(item.opID - 23001));

                        break;

                    case 41005:

                    case 41006:

                    case 41007:
                        /*  564 */
                        item.data.put("skillID", Integer.valueOf(item.opID - 33001));

                        break;

                }
                /*  567 */
                items.add(item);

            }
            /*  569 */
            this.allItemOptions.put(Integer.valueOf(dat.getName()), items);

        }

    }























































    public void loadSocketData() {
        /*  626 */
        MapleData nebuliteData = this.itemData.getData("Install/0306.img");

        /*  628 */
        for (MapleData dat : nebuliteData) {
            /*  629 */
            StructItemOption item = new StructItemOption();
            /*  630 */
            item.opID = Integer.parseInt(dat.getName());
            /*  631 */
            item.optionType = MapleDataTool.getInt("optionType", dat.getChildByPath("socket"), 0);
            /*  632 */
            for (MapleData info : dat.getChildByPath("socket/option")) {
                /*  633 */
                String optionString = MapleDataTool.getString("optionString", info, "");
                /*  634 */
                int level = MapleDataTool.getInt("level", info, 0);
                /*  635 */
                if (level > 0) {
                    /*  636 */
                    item.data.put(optionString, Integer.valueOf(level));

                }

            }
            /*  639 */
            switch (item.opID) {

                case 3063370:
                    /*  641 */
                    item.data.put("skillID", Integer.valueOf(8000));

                    break;

                case 3063380:
                    /*  644 */
                    item.data.put("skillID", Integer.valueOf(8001));

                    break;

                case 3063390:
                    /*  647 */
                    item.data.put("skillID", Integer.valueOf(8002));

                    break;

                case 3063400:
                    /*  650 */
                    item.data.put("skillID", Integer.valueOf(8003));

                    break;

                case 3064470:
                    /*  653 */
                    item.data.put("skillID", Integer.valueOf(8004));

                    break;

                case 3064480:
                    /*  656 */
                    item.data.put("skillID", Integer.valueOf(8005));

                    break;

                case 3064490:
                    /*  659 */
                    item.data.put("skillID", Integer.valueOf(8006));

                    break;

            }
            /*  662 */
            ((Map<Integer, StructItemOption>) this.allSocketItem.computeIfAbsent(Integer.valueOf(ItemConstants.getNebuliteGrade(item.opID)), integer -> new HashMap<>())).put(Integer.valueOf(item.opID), item);

        }

    }







    public void loadFamiliarItems() {
    }






    public void loadChairData() {
    }






    public void loadChatEmoticon() {
        /*  681 */
        for (MapleData d : this.uiData.getData("ChatEmoticon.img")) {
            /*  682 */
            int i = Integer.parseInt(d.getName());
        }

    }







    public void loadItemNameDesc() {
        List<Pair<Map<Integer, String>, String>> types = Arrays.asList((Pair<Map<Integer, String>, String>[]) new Pair[]{new Pair(this.allitemName, "name"), new Pair(this.allitemDesc, "desc"), new Pair(this.allitemMsg, "msg")});
        List<MapleData> mapleDatas = new ArrayList<>();
        for (MapleDataFileEntry filedata : this.stringData.getRoot().getFiles()) {
            MapleData data;
            switch (filedata.getName()) {
                case "Eqp.img":
                    data = this.stringData.getData(filedata.getName()).getChildByPath("Eqp");
                    for (MapleData typedata : data.getChildren()) {
                        mapleDatas.addAll(typedata.getChildren());
                    }

                case "Consume.img":
                case "Ins.img":
                case "Etc.img":
                case "Cash.img":
                case "Pet.img":
                    data = filedata.getName().startsWith("Etc") ? this.stringData.getData(filedata.getName()).getChildByPath("Etc") : this.stringData.getData(filedata.getName());
                    mapleDatas.addAll(data.getChildren());
            }
        }
        for (MapleData namedata : mapleDatas) {
            String itemid = namedata.getName();
            if (itemid.substring(0, 1).equals("0")) {
                itemid = itemid.substring(1, itemid.length());
            }
            for (Pair<Map<Integer, String>, String> type : types) {
//            System.out.println(type.toString());
                try {
                    if (NumberUtils.isNumber(itemid)) {
                        type.left.put(Integer.valueOf(itemid), MapleDataTool.getString(namedata.getChildByPath(type.getRight()), ""));
                    }
                } catch (Exception e) {
                    System.out.println(itemid);
                    e.printStackTrace();
                }

            }
        }
    }






    public void loadItemData() {


        /*  735 */
        List<MapleDataProvider> dataProviders = new LinkedList<>();
        /*  736 */
        dataProviders.add(this.chrData);
        /*  737 */
        dataProviders.add(this.itemData);
        /*  738 */
        Map<Integer, Map<Object, Object>> itemDataMap = new HashMap<>();
        /*  739 */
        Map<Integer, String> specialItemNameMap = new HashMap<>();
        /*  740 */
        Map<Integer, String> specialItemDescMap = new HashMap<>();
        /*  741 */
        if (BmsSerUtil.checkFileExists("ser/ItemData.ser")) {
            this.allItemData.putAll((Map<Integer, Map<Object, Object>>) BmsSerUtil.getDataFromSer("ser/ItemData.ser"));
        } else {
            for (MapleDataProvider dataProvider : dataProviders) {
                /*  742 */
                for (MapleDataDirectoryEntry topDir : dataProvider.getRoot().getSubdirectories()) {
                    /*  743 */
                    boolean isSpecial = topDir.getName().equals("Special");
                    /*  744 */
                    if (!topDir.getName().equalsIgnoreCase("Hair") && !topDir.getName().equalsIgnoreCase("Face") && !topDir.getName().equalsIgnoreCase("Afterimage")) {
                        /*  745 */
                        for (MapleDataFileEntry ifile : topDir.getFiles()) {
                            /*  746 */
                            MapleData iz = dataProvider.getData(topDir.getName() + "/" + ifile.getName());
                            /*  747 */
                            if (dataProvider.equals(this.chrData) || topDir.getName().equals("Pet")) {
                                /*  748 */
                                addItemDataToRedis(iz, itemDataMap, false, specialItemNameMap, specialItemDescMap);
                                continue;

                            } else {
                                for (MapleData data : iz) {
                                    addItemDataToRedis(data, itemDataMap, isSpecial, specialItemNameMap, specialItemDescMap);
                                }
                            }


                        }

                    }

                }

            }


            /*  759 */
            this.allItemData.putAll(itemDataMap);
            BmsSerUtil.makeSerFile("ser/ItemData.ser", this.allItemData);
        }
        /*  760 */
        if (!specialItemNameMap.isEmpty()) {
            /*  761 */
            this.allitemName.putAll(specialItemNameMap);

        }
        /*  763 */
        if (!specialItemDescMap.isEmpty()) {
            /*  764 */
            this.allitemDesc.putAll(specialItemDescMap);

        }
        log.info("共加载 " + this.allItemData.size() + " 个道具信息.");

    }






    public void loadHairAndFace() {
        /*  773 */
        MapleDataDirectoryEntry root = this.chrData.getRoot();
        /*  774 */
        for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
            /*  775 */
            if (!topDir.getName().equals("Face") && !topDir.getName().equals("Hair")) {

                continue;

            }
            /*  778 */
            for (MapleDataFileEntry iFile : topDir.getFiles()) {
                /*  779 */
                String idstr = iFile.getName().substring(0, iFile.getName().length() - 4);
                /*  780 */
                if (!StringUtil.isNumber(idstr)) {

                    continue;

                }
                /*  783 */
                this.allHairFaceID.add(Integer.valueOf(idstr));

            }

        }

    }






    public void loadFamiliarOption() {
        /*  792 */
        for (MapleData d : this.itemData.getData("FamiliarOption.img")) {
            /*  793 */
            LinkedList<StructItemOption> list2 = new LinkedList<>();
            /*  794 */
            for (MapleData subd : d.getChildByPath("level")) {
                /*  795 */
                StructItemOption au = new StructItemOption();
                /*  796 */
                au.opID = Integer.parseInt(d.getName());
                /*  797 */
                au.optionType = MapleDataTool.getInt("info/optionType", d, 0);
                /*  798 */
                au.reqLevel = MapleDataTool.getInt("info/reqLevel", d, 0);
                /*  799 */
                au.opString = MapleDataTool.getString("info/string", d, "");
                /*  800 */
                for (String i : StructItemOption.types) {
                    /*  801 */
                    if (i.equals("face")) {
                        /*  802 */
                        au.face = MapleDataTool.getString("face", subd, "");

                    } else {
                        /*  804 */
                        int level = MapleDataTool.getIntConvert(i, subd, 0);
                        /*  805 */
                        if (level > 0) {
                            /*  806 */
                            au.data.put(i, Integer.valueOf(level));

                        }

                    }

                }
                /*  810 */
                list2.add(au);

            }
            /*  812 */
            this.familiar_option.put(Integer.valueOf(Integer.parseInt(d.getName())), list2);

        }

    }


    private void addItemDataToRedis(MapleData data, Map<Integer, Map<Object, Object>> itemDataMap, boolean isSpecial, Map<Integer, String> specialItemNameMap, Map<Integer, String> specialItemDescMap) {

        String itemid;
        /*  817 */
        Map<Object, Object> info = new HashMap<>();

        /*  819 */
        if (data.getName().endsWith(".img")) {
            /*  820 */
            itemid = data.getName().substring(0, data.getName().length() - 4);

        } else {
            /*  822 */
            itemid = data.getName();

        }
        /*  824 */
        if (itemid.substring(0, 1).equals("0")) {
            /*  825 */
            itemid = itemid.substring(1, itemid.length());

        }

        try {
            /*  828 */
            for (MapleData mapleData : data) {
                /*  829 */
                if (isSpecial) {
                    /*  830 */
                    putSpecialItemInfo(info, mapleData, specialItemNameMap, specialItemDescMap, Integer.valueOf(itemid));
                    continue;

                }
                /*  832 */
                switch (mapleData.getName()) {

                    case "info":

                    case "req":

                    case "consumeItem":

                    case "mob":

                    case "replace":

                    case "skill":

                    case "reward":

                    case "spec":
                        /*  841 */
                        info.put(mapleData.getName(), MapleDataTool.getAllMapleData(mapleData));

                }





            }
            /*  848 */
        } catch (NullPointerException e) {
            /*  849 */
            e.printStackTrace();

        }

        /*  852 */
        if (info.isEmpty()) {

            return;

        }
        /*  855 */
        itemDataMap.put(Integer.valueOf(itemid.trim()), info);

    }











    private void putSpecialItemInfo(Map<Object, Object> info, MapleData mapleData, Map<Integer, String> specialItemNameMap, Map<Integer, String> specialItemDescMap, Integer itemid) {
        /*  867 */
        if (mapleData.getName().equalsIgnoreCase("name")) {
            /*  868 */
            specialItemNameMap.put(itemid, MapleDataTool.getString(mapleData));
            /*  869 */
        } else if (mapleData.getName().equalsIgnoreCase("desc")) {
            /*  870 */
            specialItemDescMap.put(itemid, MapleDataTool.getString(mapleData));
            /*  871 */
        } else if (mapleData.getName().equalsIgnoreCase("src/org/mxd/icon")) {
            /*  872 */
            Map<Object, Object> subinfos = new HashMap<>();
            /*  873 */
            int inlink = 0;
            /*  874 */
            if (mapleData.getChildren().isEmpty()) {
                /*  875 */
                String link = mapleData.getData().toString();
                /*  876 */
                if (!link.isEmpty()) {
                    /*  877 */
                    String[] split = link.split("/");
                    /*  878 */
                    for (int i = 0, splitLength = split.length; i < splitLength; i++) {
                        /*  879 */
                        String s = split[i];
                        /*  880 */
                        if (i == 1 && StringUtil.isNumber(s)) {
                            /*  881 */
                            inlink = Integer.valueOf(s).intValue();

                            break;

                        }

                    }

                }

            } else {
                /*  887 */
                for (MapleData mapleData1 : mapleData.getChildren()) {
                    /*  888 */
                    boolean isInLink = mapleData1.getName().equals("_inlink");
                    /*  889 */
                    boolean isOutLink = mapleData1.getName().equals("_outlink");
                    /*  890 */
                    if (isInLink || isOutLink) {
                        /*  891 */
                        String link = mapleData1.getData().toString();
                        /*  892 */
                        if (!link.isEmpty()) {
                            /*  893 */
                            String[] split = link.split("/");
                            /*  894 */
                            for (int i = 0; i < split.length; i++) {
                                /*  895 */
                                if (((isInLink && i == 0) || (isOutLink && i == 3)) && StringUtil.isNumber(split[i])) {
                                    /*  896 */
                                    inlink = Integer.valueOf(split[i]).intValue();

                                    break;

                                }

                            }

                        }

                    }

                }

            }
            /*  904 */
            if (inlink != 0) {
                /*  905 */
                subinfos.put("_inlink", Integer.valueOf(inlink));
                /*  906 */
                info.put("info", subinfos);

            }

        }

    }






    public List<StructItemOption> getPotentialInfo(int potId) {
        /*  915 */
        return this.allItemOptions.get(Integer.valueOf(potId));

    }








    public Map<Integer, List<StructItemOption>> getAllPotentialInfo() {
        /*  924 */
        return getPotentialInfos(-1);

    }



    public List<List<StructItemOption>> getFilterPotentials() {
        /*  928 */
        List<List<StructItemOption>> ret = new ArrayList<>();
        /*  929 */
        for (Map.Entry<Integer, List<StructItemOption>> entry : getAllPotentialInfo().entrySet()) {
            /*  930 */
            if (!CubeConfig.INSTANCE.isFilter(((Integer) entry.getKey()).intValue())) {
                /*  931 */
                ret.add(new ArrayList<>(entry.getValue()));

            }

        }
        /*  934 */
        return ret;

    }









    public Map<Integer, List<StructItemOption>> getPotentialInfos(int potId) {
        /*  944 */
        Map<Integer, List<StructItemOption>> ret = new HashMap<>();
        /*  945 */
        this.allItemOptions.forEach((integer, structItemOptions) -> {

            if (potId == -1 || integer.intValue() >= potId) {

                ret.put(integer, structItemOptions);

            }

        });
        /*  950 */
        return ret;

    }



    public Map<Integer, Pair<String, Integer>> getAllPotentialIDandName() {
        /*  954 */
        Map<Integer, Pair<String, Integer>> ret = new HashMap<>();
        /*  955 */
        getAllPotentialInfo().forEach((integer, structItemOptions) -> {

            StructItemOption option = structItemOptions.get(structItemOptions.size() - 1);

            ret.put(integer, new Pair(option.toString(), Integer.valueOf(option.optionType)));

        });
        /*  959 */
        return ret;

    }






    public String resolvePotentialId(int itemId, int potId) {
        /*  966 */
        int potLevel, eqLevel = getReqLevel(itemId);

        /*  968 */
        List<StructItemOption> potInfo = getPotentialInfo(potId);
        /*  969 */
        if (eqLevel == 0) {
            /*  970 */
            potLevel = 1;

        } else {
            /*  972 */
            potLevel = (eqLevel + 1) / 10;
            /*  973 */
            potLevel++;

        }
        /*  975 */
        if (potId <= 0) {
            /*  976 */
            return "没有潜能属性";

        }
        /*  978 */
        StructItemOption itemOption = potInfo.get(potLevel - 1);
        /*  979 */
        String ret = itemOption.opString;
        /*  980 */
        for (int i = 0; i < itemOption.opString.length(); i++) {

            /*  982 */
            if (itemOption.opString.charAt(i) == '#') {
                /*  983 */
                String curParamStripped;
                int j = i + 2;
                /*  984 */
                while (j < itemOption.opString.length() && itemOption.opString.substring(i + 1, j).matches("^(?!_)(?!.*?_$)[a-zA-Z0-9_一-龥]+$")) {
                    /*  985 */
                    j++;

                }
                /*  987 */
                String curParam = itemOption.opString.substring(i, j);


                /*  990 */
                if (j != itemOption.opString.length() || itemOption.opString.charAt(itemOption.opString.length() - 1) == '%') {
                    /*  991 */
                    curParamStripped = curParam.substring(1, curParam.length() - 1);

                } else {
                    /*  993 */
                    curParamStripped = curParam.substring(1);

                }
                /*  995 */
                String paramValue = Integer.toString(itemOption.get(curParamStripped));
                /*  996 */
                if (curParam.charAt(curParam.length() - 1) == '%') {
                    /*  997 */
                    paramValue = paramValue.concat("%");

                }
                /*  999 */
                ret = ret.replace(curParam, paramValue);

            }

        }
        /* 1002 */
        return ret;

    }






    public StructItemOption getSocketInfo(int socketId) {
        /* 1009 */
        return (StructItemOption) ((Map) this.allSocketItem.get(Integer.valueOf(ItemConstants.getNebuliteGrade(socketId)))).get(Integer.valueOf(socketId));

    }



    public Map<Integer, StructItemOption> getAllSocketInfo(int grade) {
        /* 1013 */
        return this.allSocketItem.get(Integer.valueOf(grade));

    }



    public Collection<Integer> getMonsterBookList() {
        /* 1017 */
        return this.mobIds.values();

    }



    public Map<Integer, Integer> getMonsterBook() {
        /* 1021 */
        return this.mobIds;

    }



    public Pair<Integer, Integer> getPot(int f) {
        /* 1025 */
        return this.potLife.get(Integer.valueOf(f));

    }



    public StructFamiliar getFamiliar(int f) {
        /* 1029 */
        return this.familiars.get(Integer.valueOf(f));

    }



    public Map<Integer, StructFamiliar> getFamiliars() {
        /* 1033 */
        return this.familiars;

    }



    public Map<Integer, String> getAllItemNames() {
        /* 1037 */
        return this.allitemName;

    }



    public long getAllItemSize() {
        /* 1041 */
        return this.allItemData.size();

    }



    public StructAndroid getAndroidInfo(int i) {
        /* 1045 */
        return this.androidInfo.get(Integer.valueOf(i));

    }











    protected MapleData getItemData(int itemId) {
        /* 1057 */
        MapleData ret = null;
        /* 1058 */
        String idStr = "0" + String.valueOf(itemId);
        /* 1059 */
        MapleDataDirectoryEntry root = this.itemData.getRoot();
        /* 1060 */
        for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
            /* 1061 */
            for (MapleDataFileEntry iFile : topDir.getFiles()) {
                /* 1062 */
                if (iFile.getName().equals(idStr.substring(0, 4) + ".img")) {
                    /* 1063 */
                    ret = this.itemData.getData(topDir.getName() + "/" + iFile.getName());
                    /* 1064 */
                    if (ret == null) {
                        /* 1065 */
                        return null;

                    }
                    /* 1067 */
                    ret = ret.getChildByPath(idStr);
                    /* 1068 */
                    return ret;
                    /* 1069 */
                }
                if (iFile.getName().equals(idStr.substring(1) + ".img")) {
                    /* 1070 */
                    ret = this.itemData.getData(topDir.getName() + "/" + iFile.getName());
                    /* 1071 */
                    return ret;

                }

            }

        }
        /* 1075 */
        root = this.chrData.getRoot();
        /* 1076 */
        for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
            /* 1077 */
            for (MapleDataFileEntry iFile : topDir.getFiles()) {
                /* 1078 */
                if (iFile.getName().equals(idStr + ".img")) {
                    /* 1079 */
                    ret = this.chrData.getData(topDir.getName() + "/" + iFile.getName());
                    /* 1080 */
                    return ret;

                }

            }

        }
        /* 1084 */
        return ret;

    }
















    public Integer getItemIdByMob(int mobId) {
        /* 1101 */
        return this.mobIds.get(Integer.valueOf(mobId));

    }




    private <T> T getItemProperty(int itemId, String path, T defaultValue) {
        /* 1106 */
        Map<?, ?> data = this.allItemData.get(Integer.valueOf(itemId));
        /* 1107 */
        if (data == null) {
            /* 1108 */
            return defaultValue;

        }
        /* 1110 */
        String[] loop = path.split("/");
        /* 1111 */
        Object ret = null;
        /* 1112 */
        for (String key : loop) {
            /* 1113 */
            if (data.containsKey(key)) {
                /* 1114 */
                if (data.get(key) instanceof Map) {
                    /* 1115 */
                    data = (Map<?, ?>) data.get(key);

                } else {
                    /* 1117 */
                    ret = data.get(key);

                    break;

                }

            } else {
                /* 1121 */
                return defaultValue;

            }

        }

        /* 1125 */
        if (ret == null) {
            /* 1126 */
            ret = data;

        }
        /* 1128 */
        if (ret != null && defaultValue != null && ret.getClass() != defaultValue.getClass()) {
            /* 1129 */
            if (defaultValue instanceof Long) {
                /* 1130 */
                ret = Long.valueOf(Long.parseLong(ret.toString()));
                /* 1131 */
            } else if (defaultValue instanceof Integer) {
                /* 1132 */
                ret = Integer.valueOf(Integer.parseInt(ret.toString()));
                /* 1133 */
            } else if (defaultValue instanceof Double) {
                /* 1134 */
                ret = Double.valueOf(Double.parseDouble(ret.toString()));

            }

        }






        /* 1143 */
        return (T) ret;

    }









    public Integer getSetId(int itemId) {
        /* 1153 */
        return Integer.valueOf(0);

    }






    public short getSlotMax(int itemId) {
        /* 1160 */
        int ret = ((Integer) getItemProperty(itemId, "info/slotMax", Integer.valueOf(ItemConstants.isEquip(itemId) ? 1 : 100))).intValue();
        /* 1161 */
        if (ret < ServerConfig.BACK_SLOTMAX) {
            /* 1162 */
            MapleInventoryType type = ItemConstants.getInventoryType(itemId);
            /* 1163 */
            if (type.getType() != 1) {
                /* 1164 */
                return (short) ServerConfig.BACK_SLOTMAX;

            }

        }
        /* 1167 */
        return (short) ((ret == 1 && ItemConstants.isUse(itemId)) ? 100 : ret);

    }



    public int getFamiliarID(int itemId) {
        /* 1171 */
        for (Map.Entry<Integer, StructFamiliar> entry : this.familiars.entrySet()) {
            /* 1172 */
            if (((StructFamiliar) entry.getValue()).getMonsterCardID() == itemId)
                /* 1173 */ return ((Integer) entry.getKey()).intValue();

        }
        /* 1175 */
        return 0;

    }



    public int getPrice(int itemId) {
        /* 1179 */
        return ((Integer) getItemProperty(itemId, "info/price", Integer.valueOf(0))).intValue();

    }



    public double getUnitPrice(int itemId) {
        /* 1183 */
        return ((Double) getItemProperty(itemId, "info/unitPrice", Double.valueOf(-1.0D))).doubleValue();

    }



    protected int rand(int min, int max) {
        /* 1187 */
        return Math.abs(Randomizer.rand(min, max));

    }





    public Equip levelUpEquip(Equip equip, Map<String, Integer> sta) {
        /* 1193 */
        if (sta == null) {
            /* 1194 */
            return equip;

        }

        try {
            /* 1197 */
            for (Map.Entry<String, Integer> stat : sta.entrySet()) {
                /* 1198 */
                switch ((String) stat.getKey()) {

                    case "incSTRMin":
                        /* 1200 */
                        equip.setStr((short) (equip.getStr() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incSTRMax")).intValue())));


                    case "incDEXMin":
                        /* 1203 */
                        equip.setDex((short) (equip.getDex() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incDEXMax")).intValue())));


                    case "incINTMin":
                        /* 1206 */
                        equip.setInt((short) (equip.getInt() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incINTMax")).intValue())));


                    case "incLUKMin":
                        /* 1209 */
                        equip.setLuk((short) (equip.getLuk() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incLUKMax")).intValue())));


                    case "incPADMin":
                        /* 1212 */
                        equip.setWatk((short) (equip.getWatk() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incPADMax")).intValue())));


                    case "incPDDMin":
                        /* 1215 */
                        equip.setWdef((short) (equip.getWdef() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incPDDMax")).intValue())));


                    case "incMADMin":
                        /* 1218 */
                        equip.setMatk((short) (equip.getMatk() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incMADMax")).intValue())));


                    case "incMDDMin":
                        /* 1221 */
                        equip.setMdef((short) (equip.getMdef() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incMDDMax")).intValue())));


                    case "incACCMin":
                        /* 1224 */
                        equip.setAcc((short) (equip.getAcc() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incACCMax")).intValue())));


                    case "incEVAMin":
                        /* 1227 */
                        equip.setAvoid((short) (equip.getAvoid() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incEVAMax")).intValue())));


                    case "incSpeedMin":
                        /* 1230 */
                        equip.setSpeed((short) (equip.getSpeed() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incSpeedMax")).intValue())));


                    case "incJumpMin":
                        /* 1233 */
                        equip.setJump((short) (equip.getJump() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incJumpMax")).intValue())));


                    case "incMHPMin":
                        /* 1236 */
                        equip.setHp((short) (equip.getHp() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incMHPMax")).intValue())));


                    case "incMMPMin":
                        /* 1239 */
                        equip.setMp((short) (equip.getMp() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incMMPMax")).intValue())));


                    case "incMaxHPMin":
                        /* 1242 */
                        equip.setHp((short) (equip.getHp() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incMaxHPMax")).intValue())));


                    case "incMaxMPMin":
                        /* 1245 */
                        equip.setMp((short) (equip.getMp() + rand(((Integer) stat.getValue()).intValue(), ((Integer) sta.get("incMaxMPMax")).intValue())));

                }


            }
            /* 1249 */
        } catch (NullPointerException e) {

            /* 1251 */
            e.printStackTrace();

        }
        /* 1253 */
        return equip;

    }







    public <T> T getEquipAdditions(int itemId) {
        /* 1261 */
        return getEquipAdditions(itemId, "");

    }



    public <T> T getEquipAdditions(int itemId, String path) {
        /* 1265 */
        return getItemProperty(itemId, "info/addition/" + path, null);

    }



    public Map<String, Map<String, Integer>> getEquipIncrements(int itemId) {
        /* 1269 */
        return getItemProperty(itemId, "info/level/info", null);

    }



    public List<Integer> getEquipSkills(int itemId) {
        /* 1273 */
        Map<?, ?> data = getItemProperty(itemId, "info/level/case", null);
        /* 1274 */
        if (data == null) {
            /* 1275 */
            return null;

        }
        /* 1277 */
        List<Integer> ret = new ArrayList<>();
        /* 1278 */
        for (Map.Entry<?, ?> entry : data.entrySet()) {
            /* 1279 */
            if (entry.getKey().equals("Skill") && entry.getValue() instanceof Map) {
                /* 1280 */
                for (Map.Entry<?, ?> subentry : (Iterable<Map.Entry<?, ?>>) ((Map) entry.getValue()).entrySet()) {
                    /* 1281 */
                    if (subentry.getValue() instanceof Map && ((Map) subentry.getValue()).containsKey("id")) {
                        /* 1282 */
                        ret.add((Integer) ((Map) subentry.getValue()).get("id"));

                    }

                }

            }

        }
        /* 1287 */
        return ret;

    }






    public boolean canEquip(int itemid, int level, int job, int fame, int str, int dex, int luk, int int_, int supremacy) {
        /* 1294 */
        if (level + supremacy >= getReqLevel(itemid) && str >= getReqStr(itemid) && dex >= getReqDex(itemid) && luk >= getReqLuk(itemid) && int_ >= getReqInt(itemid)) {
            /* 1295 */
            Integer fameReq = getReqPOP(itemid);
            /* 1296 */
            if (ServerConfig.WORLD_EQUIPCHECKFAME) {
                /* 1297 */
                return (fameReq != null) ? ((fame >= fameReq.intValue())) : ((fame >= 0));

            }
            /* 1299 */
            return (fameReq == null || fame >= fameReq.intValue());

        }

        /* 1302 */
        if (level + supremacy >= getReqLevel(itemid) && JobConstants.is恶魔复仇者(job))
            /* 1303 */ return true;
        /* 1304 */
        if (level + supremacy >= getReqLevel(itemid) && JobConstants.is尖兵(job)) {
            /* 1305 */
            int jobtype = getReqJob(itemid);
            /* 1306 */
            if (jobtype == 0 || jobtype == 8 || jobtype == 16 || jobtype == 24) {
                /* 1307 */
                return true;

            }

        }
        /* 1310 */
        return false;

    }






    public int getReqLevel(int itemId) {
        /* 1317 */
        return ((Integer) getItemProperty(itemId, "info/reqLevel", Integer.valueOf(0))).intValue();

    }












    public int getReqJob(int itemId) {
        /* 1330 */
        return ((Integer) getItemProperty(itemId, "info/reqJob", Integer.valueOf(0))).intValue();

    }



    public int getReqStr(int itemId) {
        /* 1334 */
        return ((Integer) getItemProperty(itemId, "info/reqSTR", Integer.valueOf(0))).intValue();

    }



    public int getReqDex(int itemId) {
        /* 1338 */
        return ((Integer) getItemProperty(itemId, "info/reqDEX", Integer.valueOf(0))).intValue();

    }



    public int getReqInt(int itemId) {
        /* 1342 */
        return ((Integer) getItemProperty(itemId, "info/reqINT", Integer.valueOf(0))).intValue();

    }



    public int getReqLuk(int itemId) {
        /* 1346 */
        return ((Integer) getItemProperty(itemId, "info/reqLUK", Integer.valueOf(0))).intValue();

    }



    public Integer getReqPOP(int itemId) {
        /* 1350 */
        return getItemProperty(itemId, "info/reqPOP", null);

    }



    public int getSlots(int itemId) {
        /* 1354 */
        return ((Integer) getItemProperty(itemId, "info/tuc", Integer.valueOf(0))).intValue();

    }



    public Integer getSetItemID(int itemId) {
        /* 1358 */
        return getItemProperty(itemId, "info/setItemID", Integer.valueOf(0));

    }



    public StructSetItem getSetItem(int setItemId) {
        /* 1362 */
        return this.allStructSetItems.get(Integer.valueOf(setItemId));

    }



    public Map<Integer, Integer> getScrollReqs(int itemId) {
        /* 1366 */
        return getItemProperty(itemId, "req", null);

    }



    public int getScrollSuccess(int itemId) {
        /* 1370 */
        return getScrollSuccess(itemId, 0);

    }



    public int getScrollSuccess(int itemId, int def) {
        /* 1374 */
        return ((Integer) getItemProperty(itemId, "info/success", Integer.valueOf(def))).intValue();

    }



    public int getScrollCursed(int itemId) {
        /* 1378 */
        return ((Integer) getItemProperty(itemId, "info/cursed", Integer.valueOf(0))).intValue();

    }



    public Map<String, Integer> getItemBaseInfo(int itemId) {
        /* 1382 */
        Map<?, ?> data = getItemProperty(itemId, "info", null);
        /* 1383 */
        if (data == null) {
            /* 1384 */
            return null;

        }

        /* 1387 */
        Map<String, Integer> ret = new HashMap<>();
        /* 1388 */
        for (Map.Entry<?, ?> entry : data.entrySet()) {
            /* 1389 */
            if (entry.getValue() instanceof Integer) {
                /* 1390 */
                ret.put(String.valueOf(entry.getKey()), (Integer) entry.getValue());

            }

        }
        /* 1393 */
        return ret;

    }



    public Item scrollEquipWithId(Item equip, Item scroll, boolean whiteScroll, MapleCharacter chr, int vegas, int number) {
        /* 1397 */
        if (equip.getType() == 1) {
            /* 1398 */
            int scrollId = scroll.getItemId();
            /* 1399 */
            if (ItemConstants.isEquipScroll(scrollId))
                /* 1400 */ return scrollEnhance(equip, scroll, chr);
            /* 1401 */
            if (ItemConstants.isPotentialScroll(scrollId))
                /* 1402 */ return scrollPotential(equip, scroll, chr);
            /* 1403 */
            if (ItemConstants.isPotentialAddScroll(scrollId))
                /* 1404 */ return scrollPotentialAdd(equip, scroll, chr);
            /* 1405 */
            if (ItemConstants.isLimitBreakScroll(scrollId))
                /* 1406 */ return scrollLimitBreak(equip, scroll, chr, number);
            /* 1407 */
            if (ItemConstants.isResetScroll(scrollId))
                /* 1408 */ return scrollResetEquip(equip, scroll, chr);
            /* 1409 */
            if (ItemConstants.isSealedScroll(scrollId))
                /* 1410 */
                return SealedConfig.SEALED_OPEN ? scrollSealedEquipEx(equip, scroll, chr) : scrollSealedEquip(equip, scroll, chr);
            /* 1411 */
            if (ItemConstants.isUpgradeItemEx(scrollId)) {
                /* 1412 */
                return scrollUpgradeItemEx(equip, scroll, chr);

            }
            /* 1414 */
            Equip nEquip = (Equip) equip;
            /* 1415 */
            Map<String, Integer> data = getItemProperty(scrollId, "info", null);

            /* 1417 */
            int succ = (ItemConstants.isTablet(scrollId) && !ItemConstants.is武器攻击力卷轴(scrollId)) ? ItemConstants.getSuccessTablet(scrollId, nEquip.getLevel()) : getScrollSuccess(scrollId);

            /* 1419 */
            int curse = (ItemConstants.isTablet(scrollId) && !ItemConstants.is武器攻击力卷轴(scrollId)) ? ItemConstants.getCurseTablet(scrollId, nEquip.getLevel()) : getScrollCursed(scrollId);

            /* 1421 */
            int craft = ItemConstants.isCleanSlate(scrollId) ? 0 : (chr.getTrait(MapleTraitType.craft).getLevel() / 10);

            /* 1423 */
            int lucksKey = ItemFlag.幸运卷轴.check(equip.getFlag()) ? 10 : 0;
            /* 1424 */
            int success = succ + lucksKey + craft + getSuccessRates(scroll.getItemId());
            /* 1425 */
            if (chr.isAdmin()) {
                /* 1426 */
                chr.dropSpouseMessage(11, "普通卷轴 - 默认几率: " + succ + "% 倾向加成: " + craft + "% 幸运状态加成: " + lucksKey + "% 最终概率: " + success + "% 失败消失几率: " + curse + "%");

            }
            /* 1428 */
            if (ItemFlag.幸运卷轴.check(equip.getFlag()) && !ItemConstants.isSpecialScroll(scrollId)) {
                /* 1429 */
                equip.setFlag((short) (equip.getFlag() - ItemFlag.幸运卷轴.getValue()));

            }
            /* 1431 */
            if (ItemConstants.isSpecialScroll(scrollId) || Randomizer.nextInt(100) <= success) {
                /* 1432 */
                short flag;
                if (data != null) {
                    /* 1433 */
                    switch (scrollId) {

                        case 2612061:

                        case 2613050:
                            /* 1436 */
                            data.put("PAD", Integer.valueOf(Randomizer.rand(9, 12)));

                            break;


                        case 2612062:

                        case 2613051:
                            /* 1441 */
                            data.put("MAD", Integer.valueOf(Randomizer.rand(9, 12)));

                            break;


                        case 2048817:

                        case 2615031:

                        case 2616061:
                            /* 1447 */
                            data.put("PAD", Integer.valueOf(Randomizer.rand(5, 7)));

                            break;


                        case 2046856:

                        case 2048804:
                            /* 1452 */
                            data.put("PAD", Integer.valueOf(Randomizer.rand(4, 5)));

                            break;


                        case 2048818:

                        case 2615032:

                        case 2616062:
                            /* 1458 */
                            data.put("MAD", Integer.valueOf(Randomizer.rand(5, 7)));

                            break;


                        case 2046857:

                        case 2048805:
                            /* 1463 */
                            data.put("MAD", Integer.valueOf(Randomizer.rand(4, 5)));

                            break;


                        case 2046170:

                        case 2046171:

                        case 2046907:

                        case 2046909:
                            /* 1470 */
                            data.put("PAD", Integer.valueOf(Randomizer.rand(7, 10)));

                            break;


                        case 2046908:

                        case 2046910:
                            /* 1475 */
                            data.put("MAD", Integer.valueOf(Randomizer.rand(7, 10)));

                            break;


                        case 2612010:

                        case 2613000:
                            /* 1480 */
                            data.put("PAD", Integer.valueOf(Randomizer.rand(8, 11)));

                            break;


                        case 2613001:
                            /* 1484 */
                            data.put("MAD", Integer.valueOf(Randomizer.rand(8, 11)));

                            break;

                    }



                }
                /* 1490 */
                NirvanaFlame oldNirvanaFlame = new NirvanaFlame(nEquip.getNirvanaFlame());

                /* 1492 */
                switch (scrollId) {

                    case 2049000:

                    case 2049001:

                    case 2049002:

                    case 2049003:

                    case 2049004:

                    case 2049005:

                    case 2049024:

                    case 2049025:
                        /* 1501 */
                        if (nEquip.getLevel() + nEquip.getUpgradeSlots() < getSlots(nEquip.getItemId()) + nEquip.getViciousHammer()) {
                            /* 1502 */
                            nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() + 1));

                        }

                        break;


                    case 2049006:

                    case 2049007:

                    case 2049008:
                        /* 1509 */
                        if (nEquip.getLevel() + nEquip.getUpgradeSlots() < getSlots(nEquip.getItemId()) + nEquip.getViciousHammer()) {
                            /* 1510 */
                            nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() + 2));

                        }

                        break;


                    case 2040727:
                        /* 1515 */
                        flag = nEquip.getFlag();
                        /* 1516 */
                        flag = (short) (flag | ItemFlag.鞋子防滑.getValue());
                        /* 1517 */
                        nEquip.setFlag(flag);

                        break;


                    case 2041058:
                        /* 1521 */
                        flag = nEquip.getFlag();
                        /* 1522 */
                        flag = (short) (flag | ItemFlag.披风防寒.getValue());
                        /* 1523 */
                        nEquip.setFlag(flag);

                        break;


                    case 2530000:

                    case 2530001:

                    case 5063100:
                        /* 1529 */
                        flag = nEquip.getFlag();
                        /* 1530 */
                        flag = (short) (flag | ItemFlag.幸运卷轴.getValue());
                        /* 1531 */
                        nEquip.setFlag(flag);

                        break;


                    case 2531000:

                    case 5064000:

                    case 5064003:
                        /* 1537 */
                        flag = nEquip.getFlag();
                        /* 1538 */
                        flag = (short) (flag | ItemFlag.装备防爆.getValue());
                        /* 1539 */
                        nEquip.setFlag(flag);

                        break;


                    case 5064100:

                    case 5068100:
                        /* 1544 */
                        flag = nEquip.getFlag();
                        /* 1545 */
                        flag = (short) (flag | ItemFlag.保护升级次数.getValue());
                        /* 1546 */
                        nEquip.setFlag(flag);

                        break;


                    case 5064300:

                    case 5068200:
                        /* 1551 */
                        flag = nEquip.getFlag();
                        /* 1552 */
                        flag = (short) (flag | ItemFlag.卷轴防护.getValue());
                        /* 1553 */
                        nEquip.setFlag(flag);

                        break;


                    default:
                        /* 1557 */
                        nEquip.getNirvanaFlame().reset();
                        /* 1558 */
                        if (ItemConstants.isChaosScroll(scrollId)) {
                            /* 1559 */
                            int stat = ItemConstants.getChaosNumber(scrollId);
                            /* 1560 */
                            int increase = (ItemConstants.isChaosForGoodness(scrollId) || isNegativeScroll(scrollId)) ? 1 : (Randomizer.nextBoolean() ? 1 : -1);
                            /* 1561 */
                            if (nEquip.getStr() > 0) {
                                /* 1562 */
                                nEquip.setStr((short) (nEquip.getStr() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1564 */
                            if (nEquip.getDex() > 0) {
                                /* 1565 */
                                nEquip.setDex((short) (nEquip.getDex() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1567 */
                            if (nEquip.getInt() > 0) {
                                /* 1568 */
                                nEquip.setInt((short) (nEquip.getInt() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1570 */
                            if (nEquip.getLuk() > 0) {
                                /* 1571 */
                                nEquip.setLuk((short) (nEquip.getLuk() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1573 */
                            if (nEquip.getWatk() > 0) {
                                /* 1574 */
                                nEquip.setWatk((short) (nEquip.getWatk() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1576 */
                            if (nEquip.getWdef() > 0) {
                                /* 1577 */
                                nEquip.setWdef((short) (nEquip.getWdef() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1579 */
                            if (nEquip.getMatk() > 0) {
                                /* 1580 */
                                nEquip.setMatk((short) (nEquip.getMatk() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1582 */
                            if (nEquip.getMdef() > 0) {
                                /* 1583 */
                                nEquip.setMdef((short) (nEquip.getMdef() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1585 */
                            if (nEquip.getAcc() > 0) {
                                /* 1586 */
                                nEquip.setAcc((short) (nEquip.getAcc() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1588 */
                            if (nEquip.getAvoid() > 0) {
                                /* 1589 */
                                nEquip.setAvoid((short) (nEquip.getAvoid() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1591 */
                            if (nEquip.getSpeed() > 0) {
                                /* 1592 */
                                nEquip.setSpeed((short) (nEquip.getSpeed() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1594 */
                            if (nEquip.getJump() > 0) {
                                /* 1595 */
                                nEquip.setJump((short) (nEquip.getJump() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1597 */
                            if (nEquip.getHp() > 0) {
                                /* 1598 */
                                nEquip.setHp((short) (nEquip.getHp() + (Randomizer.nextInt(stat) + 1) * increase));

                            }
                            /* 1600 */
                            if (nEquip.getMp() > 0)
                                /* 1601 */
                                nEquip.setMp((short) (nEquip.getMp() + (Randomizer.nextInt(stat) + 1) * increase));

                            break;

                        }
                        /* 1604 */
                        if (ItemConstants.isCleanSlate(scrollId)) {
                            /* 1605 */
                            int recover = getRecover(scrollId);
                            /* 1606 */
                            int slots = getSlots(nEquip.getItemId());
                            /* 1607 */
                            if (nEquip.getLevel() + nEquip.getUpgradeSlots() < slots + nEquip.getViciousHammer()) {
                                /* 1608 */
                                nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() + recover));

                                break;

                            }
                            /* 1611 */
                            if (chr.isAdmin()) {
                                /* 1612 */
                                chr.dropMessage(-9, "砸卷错误：不存在卷轴升级次数 " + ((recover == 0) ? 1 : 0) + " 超过可恢复次数上限 " + ((nEquip.getLevel() + nEquip.getUpgradeSlots() >= slots + nEquip.getViciousHammer()) ? 1 : 0));

                            }


                            break;

                        }
                        /* 1617 */
                        for (Map.Entry<?, ?> entry : data.entrySet()) {
                            /* 1618 */
                            if (!(entry.getValue() instanceof Integer)) {

                                continue;

                            }

                            /* 1622 */
                            String key = ((String) entry.getKey()).toUpperCase();
                            /* 1623 */
                            key = key.startsWith("INC") ? key.substring(3) : key;
                            /* 1624 */
                            Integer value = (Integer) entry.getValue();
                            /* 1625 */
                            switch (key) {

                                case "STR":
                                    /* 1627 */
                                    nEquip.setStr((short) (nEquip.getStr() + value.intValue()));


                                case "DEX":
                                    /* 1630 */
                                    nEquip.setDex((short) (nEquip.getDex() + value.intValue()));


                                case "INT":
                                    /* 1633 */
                                    nEquip.setInt((short) (nEquip.getInt() + value.intValue()));


                                case "LUK":
                                    /* 1636 */
                                    nEquip.setLuk((short) (nEquip.getLuk() + value.intValue()));


                                case "PAD":
                                    /* 1639 */
                                    nEquip.setWatk((short) (nEquip.getWatk() + value.intValue()));


                                case "PDD":
                                    /* 1642 */
                                    nEquip.setWdef((short) (nEquip.getWdef() + value.intValue()));


                                case "MAD":
                                    /* 1645 */
                                    nEquip.setMatk((short) (nEquip.getMatk() + value.intValue()));


                                case "MDD":
                                    /* 1648 */
                                    nEquip.setMdef((short) (nEquip.getMdef() + value.intValue()));


                                case "ACC":
                                    /* 1651 */
                                    nEquip.setAcc((short) (nEquip.getAcc() + value.intValue()));


                                case "EVA":
                                    /* 1654 */
                                    nEquip.setAvoid((short) (nEquip.getAvoid() + value.intValue()));


                                case "SPEED":
                                    /* 1657 */
                                    nEquip.setSpeed((short) (nEquip.getSpeed() + value.intValue()));


                                case "JUMP":
                                    /* 1660 */
                                    nEquip.setJump((short) (nEquip.getJump() + value.intValue()));


                                case "MHP":
                                    /* 1663 */
                                    nEquip.setHp((short) (nEquip.getHp() + value.intValue()));


                                case "MMP":
                                    /* 1666 */
                                    nEquip.setMp((short) (nEquip.getMp() + value.intValue()));

                            }



                        }

                        break;

                }

                /* 1674 */
                nEquip.setNirvanaFlame(oldNirvanaFlame);

                /* 1676 */
                if (!ItemConstants.isCleanSlate(scrollId) && !ItemConstants.isSpecialScroll(scrollId)) {
                    /* 1677 */
                    short oldFlag = nEquip.getFlag();
                    /* 1678 */
                    if (ItemFlag.保护升级次数.check(oldFlag)) {
                        /* 1679 */
                        nEquip.setFlag((short) (oldFlag - ItemFlag.保护升级次数.getValue()));

                    }
                    /* 1681 */
                    int scrollUseSlots = ItemConstants.isAzwanScroll(scrollId) ? getSlots(scrollId) : 1;
                    /* 1682 */
                    nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - scrollUseSlots));
                    /* 1683 */
                    nEquip.setLevel((byte) (nEquip.getLevel() + scrollUseSlots));

                }

            } else {

                /* 1687 */
                if (!whiteScroll && !ItemConstants.isCleanSlate(scrollId) && !ItemConstants.isSpecialScroll(scrollId)) {
                    /* 1688 */
                    short oldFlag = nEquip.getFlag();
                    /* 1689 */
                    if (ItemFlag.保护升级次数.check(oldFlag)) {
                        /* 1690 */
                        nEquip.setFlag((short) (oldFlag - ItemFlag.保护升级次数.getValue()));
                        /* 1691 */
                        chr.dropSpouseMessage(11, "由于卷轴的效果，升级次数没有减少。");
                        /* 1692 */
                    } else if (!getInstance().hasSafetyShield(scrollId)) {
                        /* 1693 */
                        int scrollUseSlots = ItemConstants.isAzwanScroll(scrollId) ? getSlots(scrollId) : 1;
                        /* 1694 */
                        nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - scrollUseSlots));

                    }

                }
                /* 1697 */
                if (Randomizer.nextInt(99) + 1 < curse) {
                    /* 1698 */
                    return null;

                }

            }

        }
        /* 1702 */
        return equip;

    }






    public Item scrollEnhance(Item equip, Item scroll, MapleCharacter chr) {
        /* 1709 */
        if (equip.getType() != 1) {
            /* 1710 */
            return equip;

        }
        /* 1712 */
        Equip nEquip = (Equip) equip;
        /* 1713 */
        if (nEquip.getEnhance() >= ItemConstants.getMaxEnhance(nEquip.getItemId())) {
            /* 1714 */
            return equip;

        }

        /* 1717 */
        int scrollId = scroll.getItemId();
        /* 1718 */
        boolean noCursed = isNoCursedScroll(scrollId);
        /* 1719 */
        int scrollForceUpgrade = getForceUpgrade(scrollId);

        /* 1721 */
        if (scrollForceUpgrade > 1) {
            /* 1722 */
            scrollForceUpgrade -= nEquip.getEnhance();

        }
        /* 1724 */
        int succ = getScrollSuccess(scrollId);
        /* 1725 */
        int curse = noCursed ? 0 : getScrollCursed(scrollId);
        /* 1726 */
        int craft = chr.getTrait(MapleTraitType.craft).getLevel() / 10;
        /* 1727 */
        if (scrollForceUpgrade == 1 && succ == 0) {
            /* 1728 */
            succ = Math.max(((scroll.getItemId() == 2049301 || scroll.getItemId() == 2049307) ? 80 : 100) - nEquip.getEnhance() * 10, 5);

        }
        /* 1730 */
        int success = succ + succ * craft / 100;
        /* 1731 */
        if (chr.isAdmin()) {
            /* 1732 */
            chr.dropSpouseMessage(11, "装备强化卷轴 - 默认几率: " + succ + "% 倾向加成: " + craft + "% 最终几率: " + success + "% 失败消失几率: " + curse + "% 卷轴是否失败不消失装备: " + noCursed);

        }
        /* 1734 */
        if (Randomizer.nextInt(100) > success) {
            /* 1735 */
            return (Randomizer.nextInt(99) < curse) ? null : (Item) nEquip;

        }
        /* 1737 */
        NirvanaFlame nirvanaFlame = new NirvanaFlame(nEquip.getNirvanaFlame());
        /* 1738 */
        nEquip.getNirvanaFlame().reset();

        /* 1740 */
        for (int i2 = 0; i2 < scrollForceUpgrade; i2++) {
            /* 1741 */
            EnchantHandler.Companion.toEnchantScrollHandler((Item) nEquip, false);

        }
        /* 1743 */
        nEquip.setNirvanaFlame(nirvanaFlame);
        /* 1744 */
        return (Item) nEquip;

    }





    public Item scrollPotential(Item equip, Item scroll, MapleCharacter chr) {

        String s;
        /* 1751 */
        if (equip.getType() != 1) {
            /* 1752 */
            return equip;

        }
        /* 1754 */
        Equip nEquip = (Equip) equip;
        /* 1755 */
        int scrollId = scroll.getItemId();
        /* 1756 */
        int success = getScrollSuccess(scrollId, 0);
        /* 1757 */
        boolean noCursed = isNoCursedScroll(scrollId);
        /* 1758 */
        int succ = 0;
        /* 1759 */
        int n2 = 100;

        /* 1761 */
        if (scrollId / 100 == 20494) {
            /* 1762 */
            s = "普通";
            /* 1763 */
            n2 = noCursed ? 0 : 100;
            /* 1764 */
            switch (scrollId) {

                case 2049402:

                case 2049404:

                case 2049405:

                case 2049406:

                case 2049414:

                case 2049415:

                case 2049417:

                case 2049418:

                case 2049419:

                case 2049420:
                    /* 1775 */
                    succ = 100;

                    break;


                case 2049400:

                case 2049407:

                case 2049412:
                    /* 1781 */
                    succ = 90;

                    break;


                case 2049421:

                case 2049424:
                    /* 1786 */
                    succ = 80;

                    break;


                case 2049401:

                case 2049408:

                case 2049416:
                    /* 1792 */
                    succ = 70;

                    break;

            }

            /* 1796 */
            switch (scrollId) {

                case 2049405:

                case 2049414:

                case 2049415:

                case 2049420:

                case 2049421:

                case 2049424:
                    /* 1803 */
                    s = "专用";
                    /* 1804 */
                    n2 = 0;

                    break;

            }

            /* 1808 */
        } else if (scrollId / 100 == 20497) {
            /* 1809 */
            succ = success;
            /* 1810 */
            n2 = noCursed ? 0 : getScrollCursed(scrollId);
            /* 1811 */
            if (scrollId >= 2049700 && scrollId < 2049750) {
                /* 1812 */
                s = "A级";
                /* 1813 */
            } else if (scrollId >= 2049750 && scrollId < 2049759) {
                /* 1814 */
                s = "S级";
                /* 1815 */
            } else if (scrollId == 2049762) {
                /* 1816 */
                s = "S级";

            } else {
                /* 1818 */
                succ = 0;
                /* 1819 */
                s = "未知";

            }

        } else {
            /* 1822 */
            s = "未知";

        }
        /* 1824 */
        if (chr.isAdmin()) {
            /* 1825 */
            chr.dropSpouseMessage(11, s + "潜能附加卷轴 - 成功几率: " + succ + "% 失败消失几率: " + n2 + "% 卷轴是否失败不消失装备: " + noCursed);

        }
        /* 1827 */
        if (succ <= 0) {
            /* 1828 */
            chr.dropMessage(1, "卷轴道具: " + scroll.getItemId() + " - " + getName(scroll.getItemId()) + " 成功几率为: " + succ + " 该卷轴可能还未修复。");
            /* 1829 */
            chr.sendEnableActions();
            /* 1830 */
            return (Item) nEquip;

        }
        /* 1832 */
        if (nEquip.getState(false) != 0) {
            /* 1833 */
            return (Item) nEquip;

        }
        /* 1835 */
        if (Randomizer.nextInt(100) > succ) {
            /* 1836 */
            return (Randomizer.nextInt(99) < n2) ? null : (Item) nEquip;

        }
        /* 1838 */
        if (scrollId >= 2049700 && scrollId < 2049750) {
            /* 1839 */
            nEquip.renewPotential_A();
            /* 1840 */
        } else if ((scrollId >= 2049750 && scrollId < 2049759) || scrollId == 2049762) {
            /* 1841 */
            nEquip.renewPotential_S();
            /* 1842 */
        } else if (scrollId == 2049419) {
            /* 1843 */
            int n3 = (Randomizer.nextInt(100) < 10) ? ((Randomizer.nextInt(100) < 5) ? -19 : -18) : -17;
            /* 1844 */
            nEquip.setPotential(n3, 1, false);
            /* 1845 */
            nEquip.setPotential(n3, 2, false);
            /* 1846 */
            nEquip.setPotential(n3, 3, false);
            /* 1847 */
            nEquip.initAllState();

        } else {
            /* 1849 */
            nEquip.renewPotential(false);

        }
        /* 1851 */
        return (Item) nEquip;

    }






    public Item scrollPotentialAdd(Item equip, Item scroll, MapleCharacter chr) {
        /* 1858 */
        if (equip.getType() != 1) {
            /* 1859 */
            return equip;

        }
        /* 1861 */
        Equip nEquip = (Equip) equip;
        /* 1862 */
        int scrollId = scroll.getItemId();
        /* 1863 */
        int succ = 0;
        /* 1864 */
        switch (scrollId) {

            case 2048306:

            case 2048307:

            case 2048315:
                /* 1868 */
                succ = 100;

                break;


            case 2048313:
                /* 1872 */
                succ = 80;

                break;


            case 2048305:
                /* 1876 */
                succ = 70;

                break;


            case 2048309:

            case 2048310:

            case 2048314:

            case 2048332:
                /* 1883 */
                succ = 60;

                break;


            case 2048308:

            case 2048311:
                /* 1888 */
                succ = 50;

                break;


            case 2048312:
                /* 1892 */
                succ = 1;

                break;

        }

        /* 1896 */
        int curse = 0;
        /* 1897 */
        switch (scrollId) {

            case 2048305:

            case 2048310:
                /* 1900 */
                curse = 100;

                break;


            case 2048308:

            case 2048311:
                /* 1905 */
                curse = 50;

                break;

        }

        /* 1909 */
        if (succ <= 0) {
            /* 1910 */
            chr.dropMessage(1, "卷轴道具: " + scrollId + " - " + getName(scrollId) + " 成功几率为: " + succ + " 该卷轴可能还未修复。");
            /* 1911 */
            chr.sendEnableActions();
            /* 1912 */
            return (Item) nEquip;

        }
        /* 1914 */
        if (chr.isAdmin()) {
            /* 1915 */
            chr.dropSpouseMessage(11, "附加潜能附加卷轴 - 成功几率: " + succ + "% 失败消失几率: " + curse + "% 卷轴是否失败不消失装备: " + ((curse <= 0) ? 1 : 0));

        }
        /* 1917 */
        if (Randomizer.nextInt(100) <= succ) {
            /* 1918 */
            if (scrollId == 2048306) {
                /* 1919 */
                nEquip.renewPotential(true, true);

            } else {
                /* 1921 */
                nEquip.renewPotential(true);

            }
            /* 1923 */
        } else if (Randomizer.nextInt(99) < curse) {
            /* 1924 */
            return null;

        }
        /* 1926 */
        return (Item) nEquip;

    }






    public Item scrollLimitBreak(Item equip, Item scroll, MapleCharacter chr, int number) {
        /* 1933 */
        if (equip.getType() != 1) {
            /* 1934 */
            return equip;

        }
        /* 1936 */
        Equip nEquip = (Equip) equip;
        /* 1937 */
        int scrollId = scroll.getItemId();
        /* 1938 */
        int succe = getScrollSuccess(scrollId);
        /* 1939 */
        int craft = chr.getTrait(MapleTraitType.craft).getLevel() / 10;
        /* 1940 */
        int lucksKey = ItemFlag.幸运卷轴.check(equip.getFlag()) ? 10 : 0;
        /* 1941 */
        if (ItemFlag.幸运卷轴.check(equip.getFlag())) {
            /* 1942 */
            equip.setFlag((short) (equip.getFlag() - ItemFlag.幸运卷轴.getValue()));

        }
        /* 1944 */
        int success = succe + craft + lucksKey;
        /* 1945 */
        if (chr.isAdmin()) {
            /* 1946 */
            chr.dropSpouseMessage(11, "突破攻击上限卷轴 - 默认几率: " + succe + "% 倾向加成: " + craft + "% 幸运卷轴状态加成: " + lucksKey + "% 最终几率: " + success + "%");

        }
        /* 1948 */
        if (Randomizer.nextInt(100) <= success) {
            /* 1949 */
            long limitBreakTotal = (number > 0) ? (getScrollLimitBreak(scrollId) * number) : getScrollLimitBreak(scrollId);
            /* 1950 */
            long limitBreak = limitBreakTotal + nEquip.getLimitBreak();
            /* 1951 */
            if (ItemConstants.isWeapon(nEquip.getItemId()) && limitBreak <= ServerConfig.CHANNEL_PLAYER_LIMITBREAK) {
                /* 1952 */
                nEquip.setLimitBreak(limitBreak);

            }

        }
        /* 1955 */
        return (Item) nEquip;

    }










    public Item scrollResetEquip(Item equip, Item scroll, MapleCharacter chr) {
        /* 1966 */
        if (equip.getType() != 1) {
            /* 1967 */
            return equip;

        }
        /* 1969 */
        Equip nEquip = (Equip) equip;
        /* 1970 */
        int scrollId = scroll.getItemId();
        /* 1971 */
        int succe = getScrollSuccess(scrollId);
        /* 1972 */
        int curse = getScrollCursed(scrollId);
        /* 1973 */
        int craft = chr.getTrait(MapleTraitType.craft).getLevel() / 10;
        /* 1974 */
        int lucksKey = ItemFlag.幸运卷轴.check(equip.getFlag()) ? 10 : 0;
        /* 1975 */
        if (ItemFlag.幸运卷轴.check(equip.getFlag())) {
            /* 1976 */
            equip.setFlag((short) (equip.getFlag() - ItemFlag.幸运卷轴.getValue()));

        }
        /* 1978 */
        int success = succe + craft + lucksKey;
        /* 1979 */
        if (chr.isAdmin()) {
            /* 1980 */
            chr.dropSpouseMessage(11, "还原卷轴 - 默认几率: " + succe + "% 倾向加成: " + craft + "% 幸运卷轴状态加成: " + lucksKey + "% 最终几率: " + success + "% 失败消失几率: " + curse + "%");

        }
        /* 1982 */
        if (Randomizer.nextInt(100) <= success)
            /* 1983 */ return (Item) resetEquipStats(nEquip);
        /* 1984 */
        if (Randomizer.nextInt(99) < curse) {
            /* 1985 */
            return null;

        }
        /* 1987 */
        return (Item) nEquip;

    }



    public Item scrollUpgradeItemEx(Item equip, Item scroll, MapleCharacter chr) {
        /* 1991 */
        if (equip.getType() != 1) {
            /* 1992 */
            return equip;

        }
        /* 1994 */
        Equip nEquip = (Equip) equip;
        /* 1995 */
        int scrollId = scroll.getItemId();
        /* 1996 */
        int succe = getScrollSuccess(scrollId);
        /* 1997 */
        int curse = getScrollCursed(scrollId);
        /* 1998 */
        int craft = chr.getTrait(MapleTraitType.craft).getLevel() / 10;
        /* 1999 */
        int lucksKey = ItemFlag.幸运卷轴.check(equip.getFlag()) ? 10 : 0;
        /* 2000 */
        if (ItemFlag.幸运卷轴.check(equip.getFlag())) {
            /* 2001 */
            equip.setFlag((short) (equip.getFlag() - ItemFlag.幸运卷轴.getValue()));

        }
        /* 2003 */
        int success = succe + craft + lucksKey;
        /* 2004 */
        if (chr.isAdmin()) {
            /* 2005 */
            chr.dropSpouseMessage(11, "涅槃火焰 - 默认几率: " + succe + "% 倾向加成: " + craft + "% 幸运卷轴状态加成: " + lucksKey + "% 最终几率: " + success + "% 失败消失几率: " + curse + "%");

        }
        /* 2007 */
        if (Randomizer.nextInt(100) <= success) {
            /* 2008 */
            NirvanaFlame.Companion.randomState(nEquip, scrollId);
            /* 2009 */
            chr.updateInfoQuest(53999, "dst=-1;liSN=-1;exGrade=-1", false);
            /* 2010 */
            chr.updateOneInfo(53999, "dst", String.valueOf(equip.getPosition()));
            /* 2011 */
            chr.updateOneInfo(53999, "liSN", String.valueOf(equip.getEquipOnlyId()));
            /* 2012 */
            chr.updateOneInfo(53999, "exGrade", String.valueOf(((Equip) equip).getFire()));

            /* 2014 */
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            /* 2015 */
            mplew.writeShort(SendPacketOpcode.NIRVANA_POTENTIAL_RESULT.getValue());
            /* 2016 */
            mplew.writeLong(equip.getEquipOnlyId());
            /* 2017 */
            mplew.writeBool(true);
            /* 2018 */
            PacketHelper.addEquipStats(mplew, (Equip) equip);
            /* 2019 */
            mplew.writeInt(scrollId);
            /* 2020 */
            mplew.writeInt(equip.getPosition());
            /* 2021 */
            mplew.writeInt((chr.getItemQuantity(scrollId) > 1) ? 5 : 1);
            /* 2022 */
            chr.send(mplew.getPacket());

            /* 2024 */
            short flag = equip.getFlag();
            /* 2025 */
            if (!ItemFlag.不可交易.check(flag) && !isAccountShared(equip.getItemId())) {
                /* 2026 */
                nEquip.setKarmaCount((short) 10);
                /* 2027 */
                flag = (short) (flag | (short) ItemFlag.不可交易.getValue());

            }
            /* 2029 */
            equip.setFlag(flag);

        }
        /* 2031 */
        return (Item) nEquip;

    }



    public Item scrollSealedEquip(Item equip, Item scroll, MapleCharacter chr) {
        /* 2035 */
        if (equip.getType() != 1) {
            /* 2036 */
            return equip;

        }
        /* 2038 */
        Equip nEquip = (Equip) equip;
        /* 2039 */
        if (!nEquip.isSealedEquip()) {
            /* 2040 */
            chr.dropSpouseMessage(11, "该装备不是漩涡装备，无法解除封印。");
            /* 2041 */
            return equip;

        }
        /* 2043 */
        boolean success = false;
        /* 2044 */
        byte sealedlevel = nEquip.getSealedLevel();
        /* 2045 */
        boolean isAccessory = ItemConstants.isAccessory(equip.getItemId());
        /* 2046 */
        switch (sealedlevel) {

            case 1:
                /* 2048 */
                success = true;

                break;

            case 2:
                /* 2051 */
                success = (Randomizer.nextInt(100) < (isAccessory ? 10 : 90));

                break;

            case 3:
                /* 2054 */
                success = (Randomizer.nextInt(100) < 80);

                break;

            case 4:
                /* 2057 */
                success = (Randomizer.nextInt(100) < 70);

                break;

            case 5:
                /* 2060 */
                success = (Randomizer.nextInt(100) < 50);

                break;

        }
        /* 2063 */
        List<Pair<String, Integer>> sealedinfo = getSealedEquipInfo(equip.getItemId(), sealedlevel);
        /* 2064 */
        if (sealedinfo == null) {
            /* 2065 */
            return equip;

        }
        /* 2067 */
        if (chr.isAdmin()) {
            /* 2068 */
            success = true;

        }

        /* 2071 */
        if (success) {
            /* 2072 */
            for (Pair<String, Integer> info : sealedinfo) {
                /* 2073 */
                if (((String) info.left).endsWith("STR")) {
                    /* 2074 */
                    nEquip.setStr((short) (nEquip.getStr() + ((Integer) info.right).intValue()));

                }
                /* 2076 */
                if (((String) info.left).endsWith("DEX")) {
                    /* 2077 */
                    nEquip.setDex((short) (nEquip.getDex() + ((Integer) info.right).intValue()));

                }
                /* 2079 */
                if (((String) info.left).endsWith("INT")) {
                    /* 2080 */
                    nEquip.setInt((short) (nEquip.getInt() + ((Integer) info.right).intValue()));

                }
                /* 2082 */
                if (((String) info.left).endsWith("LUK")) {
                    /* 2083 */
                    nEquip.setLuk((short) (nEquip.getLuk() + ((Integer) info.right).intValue()));

                }
                /* 2085 */
                if (((String) info.left).endsWith("PDD")) {
                    /* 2086 */
                    nEquip.setWdef((short) (nEquip.getWdef() + ((Integer) info.right).intValue()));

                }
                /* 2088 */
                if (((String) info.left).endsWith("MDD")) {
                    /* 2089 */
                    nEquip.setMdef((short) (nEquip.getMdef() + ((Integer) info.right).intValue()));

                }
                /* 2091 */
                if (((String) info.left).endsWith("MHP")) {
                    /* 2092 */
                    nEquip.setHp((short) (nEquip.getHp() + ((Integer) info.right).intValue()));

                }
                /* 2094 */
                if (((String) info.left).endsWith("MMP")) {
                    /* 2095 */
                    nEquip.setMp((short) (nEquip.getMp() + ((Integer) info.right).intValue()));

                }
                /* 2097 */
                if (((String) info.left).endsWith("PAD")) {
                    /* 2098 */
                    nEquip.setWatk((short) (nEquip.getWatk() + ((Integer) info.right).intValue()));

                }
                /* 2100 */
                if (((String) info.left).endsWith("MAD")) {
                    /* 2101 */
                    nEquip.setMatk((short) (nEquip.getMatk() + ((Integer) info.right).intValue()));

                }
                /* 2103 */
                if (((String) info.left).endsWith("ACC")) {
                    /* 2104 */
                    nEquip.setAcc((short) (nEquip.getAcc() + ((Integer) info.right).intValue()));

                }
                /* 2106 */
                if (((String) info.left).endsWith("EVA")) {
                    /* 2107 */
                    nEquip.setAvoid((short) (nEquip.getAvoid() + ((Integer) info.right).intValue()));

                }
                /* 2109 */
                if (((String) info.left).endsWith("IMDR")) {
                    /* 2110 */
                    nEquip.setIgnorePDR((short) (nEquip.getIgnorePDR() + ((Integer) info.right).intValue()));

                }
                /* 2112 */
                if (((String) info.left).endsWith("BDR") || ((String) info.left).endsWith("bdR")) {
                    /* 2113 */
                    nEquip.setBossDamage((short) (nEquip.getBossDamage() + ((Integer) info.right).intValue()));

                }

            }
            /* 2116 */
            nEquip.setSealedLevel((byte) (sealedlevel + 1));

        } else {
            /* 2118 */
            for (Pair<String, Integer> info : sealedinfo) {
                /* 2119 */
                if (((String) info.left).endsWith("STR")) {
                    /* 2120 */
                    nEquip.setStr((short) (nEquip.getStr() - ((Integer) info.right).intValue()));

                }
                /* 2122 */
                if (((String) info.left).endsWith("DEX")) {
                    /* 2123 */
                    nEquip.setDex((short) (nEquip.getDex() - ((Integer) info.right).intValue()));

                }
                /* 2125 */
                if (((String) info.left).endsWith("INT")) {
                    /* 2126 */
                    nEquip.setInt((short) (nEquip.getInt() - ((Integer) info.right).intValue()));

                }
                /* 2128 */
                if (((String) info.left).endsWith("LUK")) {
                    /* 2129 */
                    nEquip.setLuk((short) (nEquip.getLuk() - ((Integer) info.right).intValue()));

                }
                /* 2131 */
                if (((String) info.left).endsWith("PDD")) {
                    /* 2132 */
                    nEquip.setWdef((short) (nEquip.getWdef() - ((Integer) info.right).intValue()));

                }
                /* 2134 */
                if (((String) info.left).endsWith("MDD")) {
                    /* 2135 */
                    nEquip.setMdef((short) (nEquip.getMdef() - ((Integer) info.right).intValue()));

                }
                /* 2137 */
                if (((String) info.left).endsWith("MHP")) {
                    /* 2138 */
                    nEquip.setHp((short) (nEquip.getHp() - ((Integer) info.right).intValue()));

                }
                /* 2140 */
                if (((String) info.left).endsWith("MMP")) {
                    /* 2141 */
                    nEquip.setMp((short) (nEquip.getMp() - ((Integer) info.right).intValue()));

                }
                /* 2143 */
                if (((String) info.left).endsWith("PAD")) {
                    /* 2144 */
                    nEquip.setWatk((short) (nEquip.getWatk() - ((Integer) info.right).intValue()));

                }
                /* 2146 */
                if (((String) info.left).endsWith("MAD")) {
                    /* 2147 */
                    nEquip.setMatk((short) (nEquip.getMatk() - ((Integer) info.right).intValue()));

                }
                /* 2149 */
                if (((String) info.left).endsWith("ACC")) {
                    /* 2150 */
                    nEquip.setAcc((short) (nEquip.getAcc() - ((Integer) info.right).intValue()));

                }
                /* 2152 */
                if (((String) info.left).endsWith("EVA")) {
                    /* 2153 */
                    nEquip.setAvoid((short) (nEquip.getAvoid() - ((Integer) info.right).intValue()));

                }
                /* 2155 */
                if (((String) info.left).endsWith("IMDR")) {
                    /* 2156 */
                    nEquip.setIgnorePDR((short) (nEquip.getIgnorePDR() - ((Integer) info.right).intValue()));

                }
                /* 2158 */
                if (((String) info.left).endsWith("BDR") || ((String) info.left).endsWith("bdR")) {
                    /* 2159 */
                    nEquip.setBossDamage((short) (nEquip.getBossDamage() - ((Integer) info.right).intValue()));

                }

            }
            /* 2162 */
            nEquip.setSealedLevel((byte) (sealedlevel - 1));

        }
        /* 2164 */
        nEquip.setSealedExp(0L);
        /* 2165 */
        return (Item) nEquip;

    }










    public Item scrollSealedEquipEx(Item equip, Item scroll, MapleCharacter chr) {

        boolean success;
        /* 2177 */
        if (equip.getType() != 1) {
            /* 2178 */
            return equip;

        }
        /* 2180 */
        Equip nEquip = (Equip) equip;
        /* 2181 */
        if (!nEquip.isSealedEquip()) {
            /* 2182 */
            chr.dropSpouseMessage(11, "该装备不是漩涡装备，无法解除封印。");
            /* 2183 */
            return equip;

        }

        /* 2186 */
        byte sealedlevel = nEquip.getSealedLevel();
        /* 2187 */
        if (scroll.getItemId() == 2610002) {
            /* 2188 */
            success = true;

        } else {
            /* 2190 */
            int succ = MapleStatEffectFactory.parseEval(SealedConfig.SEALED_SUCC, sealedlevel);
            /* 2191 */
            success = Randomizer.isSuccess(succ);

        }
        /* 2193 */
        NirvanaFlame nf = new NirvanaFlame(nEquip.getNirvanaFlame());
        /* 2194 */
        nEquip.getNirvanaFlame().reset();
        /* 2195 */
        if (success) {
            /* 2196 */
            sealedlevel = (byte) (sealedlevel + 1);
            /* 2197 */
            if (sealedlevel > 1) {
                /* 2198 */
                nEquip.setStr((short) Math.max(0, nEquip.getStr() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_STR, sealedlevel - 1)));
                /* 2199 */
                nEquip.setDex((short) Math.max(0, nEquip.getDex() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_DEX, sealedlevel - 1)));
                /* 2200 */
                nEquip.setInt((short) Math.max(0, nEquip.getInt() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_INT, sealedlevel - 1)));
                /* 2201 */
                nEquip.setLuk((short) Math.max(0, nEquip.getLuk() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_LUK, sealedlevel - 1)));
                /* 2202 */
                nEquip.setWdef((short) Math.max(0, nEquip.getWdef() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_PDD, sealedlevel - 1)));
                /* 2203 */
                nEquip.setHp((short) Math.max(0, nEquip.getHp() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_MHP, sealedlevel - 1)));
                /* 2204 */
                nEquip.setMp((short) Math.max(0, nEquip.getMp() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_MMP, sealedlevel - 1)));
                /* 2205 */
                nEquip.setWatk((short) Math.max(0, nEquip.getWatk() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_PAD, sealedlevel - 1)));
                /* 2206 */
                nEquip.setMatk((short) Math.max(0, nEquip.getMatk() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_MAD, sealedlevel - 1)));
                /* 2207 */
                nEquip.setAcc((short) Math.max(0, nEquip.getAcc() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_ACC, sealedlevel - 1)));
                /* 2208 */
                nEquip.setAvoid((short) Math.max(0, nEquip.getAvoid() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_EVA, sealedlevel - 1)));
                /* 2209 */
                nEquip.setIgnorePDR((short) Math.max(0, nEquip.getIgnorePDR() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_IMDR, sealedlevel - 1)));
                /* 2210 */
                nEquip.setBossDamage((short) Math.max(0, nEquip.getBossDamage() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_BDR, sealedlevel - 1)));
                /* 2211 */
                nEquip.setAllStat((short) Math.max(0, nEquip.getAllStat() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_ALLSTAT, sealedlevel - 1)));
                /* 2212 */
                if (ItemConstants.isWeapon(equip.getItemId())) {
                    /* 2213 */
                    nEquip.setLimitBreakEx(Math.max(0L, nEquip.getLimitBreakEx() - MapleStatEffectFactory.parseEval(SealedConfig.SEALED_LIMITBREAK, sealedlevel - 1)));

                }

            }
            /* 2216 */
            nEquip.setStr((short) (nEquip.getStr() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_STR, sealedlevel)));
            /* 2217 */
            nEquip.setDex((short) (nEquip.getDex() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_DEX, sealedlevel)));
            /* 2218 */
            nEquip.setInt((short) (nEquip.getInt() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_INT, sealedlevel)));
            /* 2219 */
            nEquip.setLuk((short) (nEquip.getLuk() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_LUK, sealedlevel)));
            /* 2220 */
            nEquip.setWdef((short) (nEquip.getWdef() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_PDD, sealedlevel)));
            /* 2221 */
            nEquip.setHp((short) (nEquip.getHp() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_MHP, sealedlevel)));
            /* 2222 */
            nEquip.setMp((short) (nEquip.getMp() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_MMP, sealedlevel)));
            /* 2223 */
            nEquip.setWatk((short) (nEquip.getWatk() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_PAD, sealedlevel)));
            /* 2224 */
            nEquip.setMatk((short) (nEquip.getMatk() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_MAD, sealedlevel)));
            /* 2225 */
            nEquip.setAcc((short) (nEquip.getAcc() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_ACC, sealedlevel)));
            /* 2226 */
            nEquip.setAvoid((short) (nEquip.getAvoid() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_EVA, sealedlevel)));
            /* 2227 */
            nEquip.setIgnorePDR((short) (nEquip.getIgnorePDR() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_IMDR, sealedlevel)));
            /* 2228 */
            nEquip.setBossDamage((short) (nEquip.getBossDamage() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_BDR, sealedlevel)));
            /* 2229 */
            nEquip.setAllStat((short) (nEquip.getAllStat() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_ALLSTAT, sealedlevel)));
            /* 2230 */
            nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_UPGRADESLOT, sealedlevel)));
            /* 2231 */
            if (ItemConstants.isWeapon(equip.getItemId())) {
                /* 2232 */
                nEquip.setLimitBreakEx(nEquip.getLimitBreakEx() + MapleStatEffectFactory.parseEval(SealedConfig.SEALED_LIMITBREAK, sealedlevel));

            }
            /* 2234 */
            nEquip.setSealedLevel(sealedlevel);

        }
        /* 2236 */
        if (!chr.isAdmin()) {
            /* 2237 */
            nEquip.setSealedExp(0L);
            /* 2238 */
            chr.dropMessage(6, "因GM特权本次解封不消耗经验.");

        }
        /* 2240 */
        nEquip.setNirvanaFlame(nf);
        /* 2241 */
        return (Item) nEquip;

    }






    public Equip resetEquipStats(Equip oldEquip) {
        /* 2248 */
        Equip newEquip = (Equip) getEquipById(oldEquip.getItemId());

        /* 2250 */
        oldEquip.getNirvanaFlame().reset();
        /* 2251 */
        newEquip.setState(oldEquip.getState(false), false);
        /* 2252 */
        newEquip.setState(oldEquip.getState(true), true);
        /* 2253 */
        newEquip.setStateMsg(oldEquip.getStateMsg());
        /* 2254 */
        newEquip.setPotential1(oldEquip.getPotential1());
        /* 2255 */
        newEquip.setPotential2(oldEquip.getPotential2());
        /* 2256 */
        newEquip.setPotential3(oldEquip.getPotential3());
        /* 2257 */
        newEquip.setPotential4(oldEquip.getPotential4());
        /* 2258 */
        newEquip.setPotential5(oldEquip.getPotential5());
        /* 2259 */
        newEquip.setPotential6(oldEquip.getPotential6());
        /* 2260 */
        newEquip.setSocket1(oldEquip.getSocket1());
        /* 2261 */
        newEquip.setSocket2(oldEquip.getSocket2());
        /* 2262 */
        newEquip.setSocket3(oldEquip.getSocket3());
        /* 2263 */
        newEquip.setItemSkin(oldEquip.getItemSkin());

        /* 2265 */
        newEquip.setPosition(oldEquip.getPosition());
        /* 2266 */
        newEquip.setQuantity(oldEquip.getQuantity());
        /* 2267 */
        newEquip.setFlag(oldEquip.getFlag());
        /* 2268 */
        newEquip.setOwner(oldEquip.getOwner());
        /* 2269 */
        newEquip.setGMLog(oldEquip.getGMLog());
        /* 2270 */
        newEquip.setExpiration(oldEquip.getExpiration());
        /* 2271 */
        newEquip.setUniqueId(oldEquip.getUniqueId());
        /* 2272 */
        newEquip.setEquipOnlyId(oldEquip.getEquipOnlyId());
        /* 2273 */
        newEquip.setSealedExp(0L);
        /* 2274 */
        if (newEquip.isSealedEquip()) {
            /* 2275 */
            newEquip.setSealedLevel((byte) 1);

        } else {
            /* 2277 */
            newEquip.setSealedLevel((byte) 0);
            /* 2278 */
            newEquip.setBossDamage(oldEquip.getBossDamage());
            /* 2279 */
            newEquip.setIgnorePDR(oldEquip.getIgnorePDR());
            /* 2280 */
            newEquip.setAllStat(oldEquip.getAllStat());

        }
        /* 2282 */
        return newEquip;

    }



    public Item getEquipById(int equipId) {
        /* 2286 */
        return getEquipById(equipId, -1);

    }



    public Item getEquipById(int equipId, int ringId) {
        /* 2290 */
        if (!ItemConstants.isEquip(equipId)) {
            /* 2291 */
            throw new RuntimeException("非装备ID: " + equipId);

        }
        /* 2293 */
        Map<?, ?> data = getItemProperty(equipId, "info", null);
        /* 2294 */
        Equip ret = new Equip(equipId, (short) 0, ringId, (short) 0, (short) 0);
        /* 2295 */
        if (data == null) {
            /* 2296 */
            return (Item) ret;

        }

        /* 2299 */
        short stats = ItemConstants.getStat(equipId, 0);
        /* 2300 */
        if (stats > 0) {
            /* 2301 */
            ret.setStr(stats);
            /* 2302 */
            ret.setDex(stats);
            /* 2303 */
            ret.setInt(stats);
            /* 2304 */
            ret.setLuk(stats);

        }
        /* 2306 */
        stats = ItemConstants.getATK(equipId, 0);
        /* 2307 */
        if (stats > 0) {
            /* 2308 */
            ret.setWatk(stats);
            /* 2309 */
            ret.setMatk(stats);

        }
        /* 2311 */
        stats = ItemConstants.getHpMp(equipId, 0);
        /* 2312 */
        if (stats > 0) {
            /* 2313 */
            ret.setHp(stats);
            /* 2314 */
            ret.setMp(stats);

        }
        /* 2316 */
        stats = ItemConstants.getDEF(equipId, 0);
        /* 2317 */
        if (stats > 0) {
            /* 2318 */
            ret.setWdef(stats);
            /* 2319 */
            ret.setMdef(stats);

        }

        /* 2322 */
        for (Map.Entry<?, ?> entry : data.entrySet()) {
            /* 2323 */
            if (!StringUtil.isNumber(entry.getValue().toString())) {

                continue;

            }

            /* 2327 */
            String key = ((String) entry.getKey()).toUpperCase();
            /* 2328 */
            key = key.startsWith("INC") ? key.substring(3) : key;
            /* 2329 */
            Integer value = Integer.valueOf(Integer.parseInt(entry.getValue().toString()));
            /* 2330 */
            switch (key) {

                case "STR":
                    /* 2332 */
                    ret.setStr(value.shortValue());


                case "DEX":
                    /* 2335 */
                    ret.setDex(value.shortValue());


                case "INT":
                    /* 2338 */
                    ret.setInt(value.shortValue());


                case "LUK":
                    /* 2341 */
                    ret.setLuk(value.shortValue());


                case "PAD":
                    /* 2344 */
                    ret.setWatk(value.shortValue());


                case "PDD":
                    /* 2347 */
                    ret.setWdef(value.shortValue());


                case "MAD":
                    /* 2350 */
                    ret.setMatk(value.shortValue());


                case "MDD":
                    /* 2353 */
                    ret.setMdef(value.shortValue());


                case "ACC":
                    /* 2356 */
                    ret.setAcc(value.shortValue());


                case "EVA":
                    /* 2359 */
                    ret.setAvoid(value.shortValue());


                case "SPEED":
                    /* 2362 */
                    ret.setSpeed(value.shortValue());


                case "JUMP":
                    /* 2365 */
                    ret.setJump(value.shortValue());


                case "MHP":
                    /* 2368 */
                    ret.setHp(value.shortValue());


                case "MMP":
                    /* 2371 */
                    ret.setMp(value.shortValue());


                case "TUC":
                    /* 2374 */
                    ret.setUpgradeSlots(value.byteValue());


                case "CRAFT":
                    /* 2377 */
                    ret.setHands(value.shortValue());


                case "DURABILITY":
                    /* 2380 */
                    ret.setDurability(value.intValue());


                case "CHARMEXP":
                    /* 2383 */
                    ret.setCharmEXP(value.shortValue());


                case "PVPDAMAGE":
                    /* 2386 */
                    ret.setPVPDamage(value.shortValue());


                case "BDR":
                    /* 2389 */
                    ret.setBossDamage(value.shortValue());


                case "IMDR":
                    /* 2392 */
                    ret.setIgnorePDR(value.shortValue());


                case "DAMR":
                    /* 2395 */
                    ret.setTotalDamage(value.shortValue());


                case "ARC":
                    /* 2398 */
                    ret.setARC(value.shortValue());

            }



        }
        /* 2403 */
        Object cash = data.get("cash");
        /* 2404 */
        if (cash != null && Boolean.valueOf(cash.toString()).booleanValue() && ret.getCharmEXP() <= 0) {
            /* 2405 */
            short exp = 0;
            /* 2406 */
            int identifier = equipId / 10000;
            /* 2407 */
            if (ItemConstants.isWeapon(equipId) || identifier == 106) {
                /* 2408 */
                exp = 60;
                /* 2409 */
            } else if (identifier == 100) {
                /* 2410 */
                exp = 50;
                /* 2411 */
            } else if (ItemConstants.isAccessory(equipId) || identifier == 102 || identifier == 108 || identifier == 107) {
                /* 2412 */
                exp = 40;
                /* 2413 */
            } else if (identifier == 104 || identifier == 105 || identifier == 110) {
                /* 2414 */
                exp = 30;

            }
            /* 2416 */
            ret.setCharmEXP(exp);

        }

        /* 2419 */
        ret.setUniqueId(ringId);
        /* 2420 */
        return (Item) ret;

    }



    protected short getRandStatFusion(short defaultValue, int value1, int value2) {
        /* 2424 */
        if (defaultValue == 0) {
            /* 2425 */
            return 0;

        }
        /* 2427 */
        int range = (value1 + value2) / 2 - defaultValue;
        /* 2428 */
        int rand = Randomizer.nextInt(Math.abs(range) + 1);
        /* 2429 */
        return (short) (defaultValue + ((range < 0) ? -rand : rand));

    }



    protected short getRandStat(short defaultValue, int maxRange) {
        /* 2433 */
        if (defaultValue == 0) {
            /* 2434 */
            return 0;

        }

        /* 2437 */
        int lMaxRange = (int) Math.min(Math.ceil(defaultValue * 0.1D), maxRange);
        /* 2438 */
        return (short) (defaultValue - lMaxRange + Randomizer.nextInt(lMaxRange * 2 + 1));

    }



    protected short getRandStatAbove(short defaultValue, int maxRange) {
        /* 2442 */
        if (defaultValue <= 0) {
            /* 2443 */
            return 0;

        }
        /* 2445 */
        int lMaxRange = (int) Math.min(Math.ceil(defaultValue * 0.1D), maxRange);
        /* 2446 */
        return (short) (defaultValue + Randomizer.nextInt(lMaxRange + 1));

    }



    public Equip randomizeStats(Equip equip) {
        /* 2450 */
        equip.setStr(getRandStat(equip.getStr(), 5));
        /* 2451 */
        equip.setDex(getRandStat(equip.getDex(), 5));
        /* 2452 */
        equip.setInt(getRandStat(equip.getInt(), 5));
        /* 2453 */
        equip.setLuk(getRandStat(equip.getLuk(), 5));
        /* 2454 */
        equip.setMatk(getRandStat(equip.getMatk(), 5));
        /* 2455 */
        equip.setWatk(getRandStat(equip.getWatk(), 5));
        /* 2456 */
        equip.setAcc(getRandStat(equip.getAcc(), 5));
        /* 2457 */
        equip.setAvoid(getRandStat(equip.getAvoid(), 5));
        /* 2458 */
        equip.setJump(getRandStat(equip.getJump(), 5));
        /* 2459 */
        equip.setHands(getRandStat(equip.getHands(), 5));
        /* 2460 */
        equip.setSpeed(getRandStat(equip.getSpeed(), 5));
        /* 2461 */
        equip.setWdef(getRandStat(equip.getWdef(), 10));
        /* 2462 */
        equip.setMdef(getRandStat(equip.getMdef(), 10));
        /* 2463 */
        equip.setHp(getRandStat(equip.getHp(), 10));
        /* 2464 */
        equip.setMp(getRandStat(equip.getMp(), 10));
        /* 2465 */
        equip.setSealedLevel((byte) (equip.isSealedEquip() ? 1 : 0));
        /* 2466 */
        equip.setBossDamage((short) getBossDamageRate(equip.getItemId()));
        /* 2467 */
        equip.setIgnorePDR((short) getIgnoreMobDmageRate(equip.getItemId()));
        /* 2468 */
        equip.setTotalDamage((short) getTotalDamage(equip.getItemId()));
        /* 2469 */
        equip.setPotential1(getOption(equip.getItemId(), 1));
        /* 2470 */
        equip.setPotential2(getOption(equip.getItemId(), 2));
        /* 2471 */
        equip.setPotential3(getOption(equip.getItemId(), 3));
        /* 2472 */
        return equip;

    }



    public Equip randomizeStats_Above(Equip equip) {
        /* 2476 */
        equip.setStr(getRandStatAbove(equip.getStr(), 5));
        /* 2477 */
        equip.setDex(getRandStatAbove(equip.getDex(), 5));
        /* 2478 */
        equip.setInt(getRandStatAbove(equip.getInt(), 5));
        /* 2479 */
        equip.setLuk(getRandStatAbove(equip.getLuk(), 5));
        /* 2480 */
        equip.setMatk(getRandStatAbove(equip.getMatk(), 5));
        /* 2481 */
        equip.setWatk(getRandStatAbove(equip.getWatk(), 5));
        /* 2482 */
        equip.setAcc(getRandStatAbove(equip.getAcc(), 5));
        /* 2483 */
        equip.setAvoid(getRandStatAbove(equip.getAvoid(), 5));
        /* 2484 */
        equip.setJump(getRandStatAbove(equip.getJump(), 5));
        /* 2485 */
        equip.setHands(getRandStatAbove(equip.getHands(), 5));
        /* 2486 */
        equip.setSpeed(getRandStatAbove(equip.getSpeed(), 5));
        /* 2487 */
        equip.setWdef(getRandStatAbove(equip.getWdef(), 10));
        /* 2488 */
        equip.setMdef(getRandStatAbove(equip.getMdef(), 10));
        /* 2489 */
        equip.setHp(getRandStatAbove(equip.getHp(), 10));
        /* 2490 */
        equip.setMp(getRandStatAbove(equip.getMp(), 10));
        /* 2491 */
        equip.setSealedLevel((byte) (equip.isSealedEquip() ? 1 : 0));
        /* 2492 */
        equip.setBossDamage((short) getBossDamageRate(equip.getItemId()));
        /* 2493 */
        equip.setIgnorePDR((short) getIgnoreMobDmageRate(equip.getItemId()));
        /* 2494 */
        equip.setTotalDamage((short) getTotalDamage(equip.getItemId()));
        /* 2495 */
        equip.setPotential1(getOption(equip.getItemId(), 1));
        /* 2496 */
        equip.setPotential2(getOption(equip.getItemId(), 2));
        /* 2497 */
        equip.setPotential3(getOption(equip.getItemId(), 3));
        /* 2498 */
        return equip;

    }



    public Equip fuse(Equip equip1, Equip equip2) {
        /* 2502 */
        if (equip1.getItemId() != equip2.getItemId()) {
            /* 2503 */
            return equip1;

        }
        /* 2505 */
        Equip equip = (Equip) getEquipById(equip1.getItemId());
        /* 2506 */
        equip.setStr(getRandStatFusion(equip.getStr(), equip1.getStr(), equip2.getStr()));
        /* 2507 */
        equip.setDex(getRandStatFusion(equip.getDex(), equip1.getDex(), equip2.getDex()));
        /* 2508 */
        equip.setInt(getRandStatFusion(equip.getInt(), equip1.getInt(), equip2.getInt()));
        /* 2509 */
        equip.setLuk(getRandStatFusion(equip.getLuk(), equip1.getLuk(), equip2.getLuk()));
        /* 2510 */
        equip.setMatk(getRandStatFusion(equip.getMatk(), equip1.getMatk(), equip2.getMatk()));
        /* 2511 */
        equip.setWatk(getRandStatFusion(equip.getWatk(), equip1.getWatk(), equip2.getWatk()));
        /* 2512 */
        equip.setAcc(getRandStatFusion(equip.getAcc(), equip1.getAcc(), equip2.getAcc()));
        /* 2513 */
        equip.setAvoid(getRandStatFusion(equip.getAvoid(), equip1.getAvoid(), equip2.getAvoid()));
        /* 2514 */
        equip.setJump(getRandStatFusion(equip.getJump(), equip1.getJump(), equip2.getJump()));
        /* 2515 */
        equip.setHands(getRandStatFusion(equip.getHands(), equip1.getHands(), equip2.getHands()));
        /* 2516 */
        equip.setSpeed(getRandStatFusion(equip.getSpeed(), equip1.getSpeed(), equip2.getSpeed()));
        /* 2517 */
        equip.setWdef(getRandStatFusion(equip.getWdef(), equip1.getWdef(), equip2.getWdef()));
        /* 2518 */
        equip.setMdef(getRandStatFusion(equip.getMdef(), equip1.getMdef(), equip2.getMdef()));
        /* 2519 */
        equip.setHp(getRandStatFusion(equip.getHp(), equip1.getHp(), equip2.getHp()));
        /* 2520 */
        equip.setMp(getRandStatFusion(equip.getMp(), equip1.getMp(), equip2.getMp()));
        /* 2521 */
        return equip;

    }



    public int get休彼德蔓徽章点数(int itemId) {
        /* 2525 */
        switch (itemId) {

            case 1182000:
                /* 2527 */
                return 3;

            case 1182001:
                /* 2529 */
                return 5;

            case 1182002:
                /* 2531 */
                return 7;

            case 1182003:
                /* 2533 */
                return 9;

            case 1182004:
                /* 2535 */
                return 13;

            case 1182005:
                /* 2537 */
                return 16;

        }
        /* 2539 */
        return 0;

    }



    public Equip randomize休彼德蔓徽章(Equip equip) {
        /* 2543 */
        int stats = get休彼德蔓徽章点数(equip.getItemId());
        /* 2544 */
        if (stats > 0) {
            /* 2545 */
            int prob = equip.getItemId() - 1182000;
            /* 2546 */
            if (Randomizer.nextInt(15) <= prob) {
                /* 2547 */
                equip.setStr((short) Randomizer.nextInt(stats + prob));

            }
            /* 2549 */
            if (Randomizer.nextInt(15) <= prob) {
                /* 2550 */
                equip.setDex((short) Randomizer.nextInt(stats + prob));

            }
            /* 2552 */
            if (Randomizer.nextInt(15) <= prob) {
                /* 2553 */
                equip.setInt((short) Randomizer.nextInt(stats + prob));

            }
            /* 2555 */
            if (Randomizer.nextInt(15) <= prob) {
                /* 2556 */
                equip.setLuk((short) Randomizer.nextInt(stats + prob));

            }
            /* 2558 */
            if (Randomizer.nextInt(30) <= prob) {
                /* 2559 */
                equip.setWatk((short) Randomizer.nextInt(stats));

            }
            /* 2561 */
            if (Randomizer.nextInt(10) <= prob) {
                /* 2562 */
                equip.setWdef((short) Randomizer.nextInt(stats * 8));

            }
            /* 2564 */
            if (Randomizer.nextInt(30) <= prob) {
                /* 2565 */
                equip.setMatk((short) Randomizer.nextInt(stats));

            }
            /* 2567 */
            if (Randomizer.nextInt(10) <= prob) {
                /* 2568 */
                equip.setMdef((short) Randomizer.nextInt(stats * 8));

            }
            /* 2570 */
            if (Randomizer.nextInt(8) <= prob) {
                /* 2571 */
                equip.setAcc((short) Randomizer.nextInt(stats * 5));

            }
            /* 2573 */
            if (Randomizer.nextInt(8) <= prob) {
                /* 2574 */
                equip.setAvoid((short) Randomizer.nextInt(stats * 5));

            }
            /* 2576 */
            if (Randomizer.nextInt(10) <= prob) {
                /* 2577 */
                equip.setSpeed((short) Randomizer.nextInt(stats));

            }
            /* 2579 */
            if (Randomizer.nextInt(10) <= prob) {
                /* 2580 */
                equip.setJump((short) Randomizer.nextInt(stats));

            }
            /* 2582 */
            if (Randomizer.nextInt(8) <= prob) {
                /* 2583 */
                equip.setHp((short) Randomizer.nextInt(stats * 10));

            }
            /* 2585 */
            if (Randomizer.nextInt(8) <= prob) {
                /* 2586 */
                equip.setMp((short) Randomizer.nextInt(stats * 10));

            }

        }
        /* 2589 */
        return equip;

    }



    public int getTotalStat(Equip equip) {
        /* 2593 */
        return equip.getStr() + equip.getDex() + equip.getInt() + equip.getLuk() + equip.getMatk() + equip.getWatk() + equip.getAcc() + equip.getAvoid() + equip.getJump() + equip
/* 2594 */.getHands() + equip.getSpeed() + equip.getHp() + equip.getMp() + equip.getWdef() + equip.getMdef();

    }











    public Equip setPotentialState(Equip equip, int state) {
        /* 2606 */
        if (equip.getState(false) == 0) {
            /* 2607 */
            if (state == 1) {
                /* 2608 */
                equip.setPotential1(-17);
                /* 2609 */
            } else if (state == 2) {
                /* 2610 */
                equip.setPotential1(-18);
                /* 2611 */
            } else if (state == 3) {
                /* 2612 */
                equip.setPotential1(-19);
                /* 2613 */
            } else if (state == 4) {
                /* 2614 */
                equip.setPotential1(-20);

            } else {
                /* 2616 */
                equip.setPotential1(-17);

            }

        }
        /* 2619 */
        return equip;

    }



    public MapleStatEffect getItemEffect(int itemId) {
        /* 2623 */
        MapleStatEffect ret = this.itemEffects.get(Integer.valueOf(itemId));
        /* 2624 */
        if (ret == null) {
            /* 2625 */
            MapleData item = getItemData(itemId);
            /* 2626 */
            if (item == null || item.getChildByPath("spec") == null) {
                /* 2627 */
                return null;

            }
            /* 2629 */
            ret = MapleStatEffectFactory.loadItemEffectFromData(item.getChildByPath("spec"), itemId);
            /* 2630 */
            this.itemEffects.put(Integer.valueOf(itemId), ret);

        }
        /* 2632 */
        return ret;

    }



    public MapleStatEffect getItemEffectEX(int itemId) {
        /* 2636 */
        MapleStatEffect ret = this.itemEffectsEx.get(Integer.valueOf(itemId));
        /* 2637 */
        if (ret == null) {
            /* 2638 */
            MapleData item = getItemData(itemId);
            /* 2639 */
            if (item == null || item.getChildByPath("specEx") == null) {
                /* 2640 */
                return null;

            }
            /* 2642 */
            ret = MapleStatEffectFactory.loadItemEffectFromData(item.getChildByPath("specEx"), itemId);
            /* 2643 */
            this.itemEffectsEx.put(Integer.valueOf(itemId), ret);

        }
        /* 2645 */
        return ret;

    }



    public int getCreateId(int id) {
        /* 2649 */
        return ((Integer) getItemProperty(id, "info/create", Integer.valueOf(0))).intValue();

    }



    public int getCardMobId(int id) {
        /* 2653 */
        return ((Integer) getItemProperty(id, "info/mob", Integer.valueOf(0))).intValue();

    }



    public int getBagType(int id) {
        /* 2657 */
        return ((Integer) getItemProperty(id, "info/bagType", Integer.valueOf(0))).intValue();

    }



    public int getWatkForProjectile(int itemId) {
        /* 2661 */
        return ((Integer) getItemProperty(itemId, "info/incPAD", Integer.valueOf(0))).intValue();

    }







    public boolean canScroll(int scrollid, int itemid) {
        /* 2669 */
        return (scrollid / 100 % 100 == itemid / 10000 % 100 || (itemid >= 1672000 && itemid <= 1672010) || ItemConstants.isPetEquip(itemid));

    }






    public String getName(int itemId) {
        /* 2676 */
        return this.allitemName.get(Integer.valueOf(itemId));

    }






    public String getDesc(int itemId) {
        /* 2683 */
        return this.allitemDesc.get(Integer.valueOf(itemId));

    }



    public String getMsg(int itemId) {
        /* 2687 */
        return this.allitemMsg.get(Integer.valueOf(itemId));

    }



    public short getItemMakeLevel(int itemId) {
        /* 2691 */
        return ((Integer) getItemProperty(itemId, "info/lv", Integer.valueOf(0))).shortValue();

    }





















    public boolean cantSell(int itemId) {
        /* 2713 */
        return (((Integer) getItemProperty(itemId, "info/notSale", Integer.valueOf(0))).intValue() == 1);

    }






    public boolean isLogoutExpire(int itemId) {
        /* 2720 */
        return (((Integer) getItemProperty(itemId, "info/expireOnLogout", Integer.valueOf(0))).intValue() == 1);

    }






    public boolean isPickupBlocked(int itemId) {
        /* 2727 */
        return (((Integer) getItemProperty(itemId, "info/pickUpBlock", Integer.valueOf(0))).intValue() == 1);

    }



    public boolean isPickupRestricted(int itemId) {
        /* 2731 */
        return ((((Integer) getItemProperty(itemId, "info/only", Integer.valueOf(0))).intValue() == 1 || ItemConstants.isPickupRestricted(itemId)) && itemId != 4001168);

    }



    public boolean isAccountShared(int itemId) {
        /* 2735 */
        return (((Integer) getItemProperty(itemId, "info/accountSharable", Integer.valueOf(0))).intValue() == 1);

    }



    public boolean isQuestItem(int itemId) {
        /* 2739 */
        return (((Integer) getItemProperty(itemId, "info/quest", Integer.valueOf(0))).intValue() == 1 && itemId / 10000 != 301);

    }



    public boolean isDropRestricted(int itemId) {
        /* 2743 */
        return (((Integer) getItemProperty(itemId, "info/quest", Integer.valueOf(0))).intValue() == 1 || ((Integer) getItemProperty(itemId, "info/tradeBlock", Integer.valueOf(0))).intValue() == 1 || ItemConstants.isDropRestricted(itemId));

    }



    public boolean isShareTagEnabled(int itemId) {
        /* 2747 */
        return (((Integer) getItemProperty(itemId, "info/accountShareTag", Integer.valueOf(0))).intValue() == 1);

    }



    public boolean isMobHP(int itemId) {
        /* 2751 */
        return (((Integer) getItemProperty(itemId, "info/mobHP", Integer.valueOf(0))).intValue() == 1);

    }



    public boolean isEquipTradeBlock(int itemId) {
        /* 2755 */
        return (((Integer) getItemProperty(itemId, "info/equipTradeBlock", Integer.valueOf(0))).intValue() == 1);

    }






    public boolean isActivatedSocketItem(int itemId) {
        /* 2762 */
        return (((Integer) getItemProperty(itemId, "info/nActivatedSocket", Integer.valueOf(0))).intValue() == 1);

    }






    public boolean isSuperiorEquip(int itemId) {
        /* 2769 */
        return (((Integer) getItemProperty(itemId, "info/superiorEqp", Integer.valueOf(0))).intValue() == 1);

    }






    public boolean isOnlyEquip(int itemId) {
        /* 2776 */
        return (((Integer) getItemProperty(itemId, "info/onlyEquip", Integer.valueOf(0))).intValue() == 1);

    }



    public int getStateChangeItem(int itemId) {
        /* 2780 */
        return ((Integer) getItemProperty(itemId, "info/stateChangeItem", Integer.valueOf(0))).intValue();

    }



    public int getMeso(int itemId) {
        /* 2784 */
        return ((Integer) getItemProperty(itemId, "info/meso", Integer.valueOf(0))).intValue();

    }



    public boolean isTradeAvailable(int itemId) {
        /* 2788 */
        return (((Integer) getItemProperty(itemId, "info/tradeAvailable", Integer.valueOf(0))).intValue() == 1);

    }



    public boolean isPKarmaEnabled(int itemId) {
        /* 2792 */
        return (((Integer) getItemProperty(itemId, "info/tradeAvailable", Integer.valueOf(0))).intValue() == 2);

    }



    public Pair<Integer, List<Map<String, String>>> getRewardItem(int itemId) {
        Map<?, ?> data = getItemProperty(itemId, "reward", null);
        if (data == null) {
            return null;
        }
        List<Map<String, String>> ret = new ArrayList<>();
        int totalprob = 0;
        for (Map.Entry<?, ?> entry : data.entrySet()) {
            Map<String, String> rewards = new HashMap<>();
            ((Map<?, ?>) entry.getValue()).forEach((o, o2) -> rewards.put((String) o, o2 instanceof Integer ? String.valueOf(o2) : (String) o2));
            ret.add(rewards);
            totalprob += rewards.containsKey("prob") ? Integer.valueOf(rewards.get("prob")) : 0;
        }
        return new Pair<>(totalprob, ret);

    }



    public Pair<Integer, Map<Integer, Integer>> questItemInfo(int itemId) {
        /* 2812 */
        Integer questId = getItemProperty(itemId, "info/questId", Integer.valueOf(0));
        /* 2813 */
        Map<?, ?> data = getItemProperty(itemId, "info/consumeItem", null);
        /* 2814 */
        if (data == null) {
            /* 2815 */
            return null;

        }
        /* 2817 */
        Map<Integer, Integer> ret = new HashMap<>();
        /* 2818 */
        for (Map.Entry<?, ?> entry : data.entrySet()) {
            /* 2819 */
            if (entry.getValue() instanceof Map) {
                /* 2820 */
                Map<Integer, Integer> subentry = (Map<Integer, Integer>) entry.getValue();
                /* 2821 */
                ret.put(subentry.get(Integer.valueOf(0)), subentry.get(Integer.valueOf(1)));
                continue;

            }
            /* 2823 */
            ret.put((Integer) entry.getValue(), 1);

        }

        /* 2826 */
        return new Pair(questId, ret);

    }



    public Map<String, String> replaceItemInfo(int itemId) {
        /* 2830 */
        Map<String, String> data = getItemProperty(itemId, "info/replace", new HashMap<>());
        /* 2831 */
        if (data == null) {
            /* 2832 */
            return null;

        }
        /* 2834 */
        return data;

    }



    public List<Triple<String, Point, Point>> getAfterImage(String after) {
        /* 2838 */
        return this.afterImage.get(after);

    }



    public String getAfterImage(int itemId) {
        /* 2842 */
        return getItemProperty(itemId, "info/afterImage", null);

    }



    public boolean itemExists(int itemId) {
        /* 2846 */
        if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.UNDEFINED) {
            /* 2847 */
            return false;

        }
        /* 2849 */
        return this.allItemData.containsKey(Integer.valueOf(itemId));

    }



    public boolean isCash(int itemId) {
        /* 2853 */
        return (ItemConstants.getInventoryType(itemId) == MapleInventoryType.CASH || String.valueOf(getItemProperty(itemId, "info/cash", "0")).equals("1"));

    }



    public double getExpCardRate(int itemId) {
        /* 2857 */
        return (((Integer) getItemProperty(itemId, "info/rate", Integer.valueOf(100))).intValue() / 100);

    }



    public int getExpCardMaxLevel(int itemId) {
        /* 2861 */
        return ((Integer) getItemProperty(itemId, "info/maxLevel", Integer.valueOf(249))).intValue();

    }



    public boolean isExpOrDropCardTime(int itemId) {
        /* 2865 */
        Map<Integer, String> data = getItemProperty(itemId, "info/time", null);
        /* 2866 */
        if (data == null) {
            /* 2867 */
            return false;

        }
        /* 2869 */
        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("Asia/ShangHai"));
        /* 2870 */
        String day = DateUtil.getDayInt(cal.get(7));

        /* 2872 */
        Map<String, String> times = new HashMap<>();
        /* 2873 */
        for (String childdata : data.values()) {
            /* 2874 */
            String[] time = childdata.split(":");
            /* 2875 */
            times.put(time[0], time[1]);

        }
        /* 2877 */
        cal.get(7);
        /* 2878 */
        if (times.containsKey(day)) {
            /* 2879 */
            String[] hourspan = ((String) times.get(day)).split("-");
            /* 2880 */
            int starthour = Integer.parseInt(hourspan[0]);
            /* 2881 */
            int endhour = Integer.parseInt(hourspan[1]);

            /* 2883 */
            if (cal.get(11) >= starthour && cal.get(11) <= endhour) {
                /* 2884 */
                return true;

            }

        }
        /* 2887 */
        return false;

    }






    public ScriptedItem getScriptedItemInfo(int itemId) {
        /* 2894 */
        if (itemId / 10000 != 243 && itemId / 10000 != 263) {
            /* 2895 */
            return null;

        }
        /* 2897 */
        return new ScriptedItem(((Integer)
                /* 2898 */         getItemProperty(itemId, "spec/npc", Integer.valueOf(0))).intValue(),
                /* 2899 */         getItemProperty(itemId, "spec/script", ""),
                /* 2900 */         (((Integer) getItemProperty(itemId, "spec/runOnPickup", Integer.valueOf(0))).intValue() == 1));

    }






    public StructCrossHunterShop getCrossHunterShop(int key) {
        /* 2907 */
        if (this.crossHunterShop.containsKey(Integer.valueOf(key))) {
            /* 2908 */
            return this.crossHunterShop.get(Integer.valueOf(key));

        }
        /* 2910 */
        return null;

    }






    public boolean isFloatCashItem(int itemId) {
        /* 2917 */
        return (itemId / 10000 == 512 && ((Integer) getItemProperty(itemId, "info/floatType", Integer.valueOf(0))).intValue() == 1);

    }






    public short getPetFlagInfo(int itemId) {
        /* 2924 */
        short flag = 0;
        /* 2925 */
        if (itemId / 10000 != 500) {
            /* 2926 */
            return flag;

        }
        /* 2928 */
        if (!itemExists(itemId)) {
            /* 2929 */
            return flag;

        }
        /* 2931 */
        if (((Integer) getItemProperty(itemId, "info/pickupItem", Integer.valueOf(0))).intValue() == 1) {
            /* 2932 */
            flag = (short) (flag | 0x1);

        }
        /* 2934 */
        if (((Integer) getItemProperty(itemId, "info/longRange", Integer.valueOf(0))).intValue() == 1) {
            /* 2935 */
            flag = (short) (flag | 0x2);

        }
        /* 2937 */
        if (((Integer) getItemProperty(itemId, "info/pickupAll", Integer.valueOf(0))).intValue() == 1) {
            /* 2938 */
            flag = (short) (flag | 0x4);

        }
        /* 2940 */
        if (((Integer) getItemProperty(itemId, "info/sweepForDrop", Integer.valueOf(0))).intValue() == 1) {
            /* 2941 */
            flag = (short) (flag | 0x10);

        }
        /* 2943 */
        if (((Integer) getItemProperty(itemId, "info/consumeHP", Integer.valueOf(0))).intValue() == 1) {
            /* 2944 */
            flag = (short) (flag | 0x20);

        }
        /* 2946 */
        if (((Integer) getItemProperty(itemId, "info/consumeMP", Integer.valueOf(0))).intValue() == 1) {
            /* 2947 */
            flag = (short) (flag | 0x40);

        }
        /* 2949 */
        if (((Integer) getItemProperty(itemId, "info/autoBuff", Integer.valueOf(0))).intValue() == 1) {
            /* 2950 */
            flag = (short) (flag | 0x200);

        }
        /* 2952 */
        return flag;

    }






    public int getPetSetItemID(int itemId) {
        /* 2959 */
        if (itemId / 10000 != 500) {
            /* 2960 */
            return -1;

        }
        /* 2962 */
        return ((Integer) getItemProperty(itemId, "info/setItemID", Integer.valueOf(0))).intValue();

    }






    public int getItemIncMHPr(int itemId) {
        /* 2969 */
        return ((Integer) getItemProperty(itemId, "info/MHPr", Integer.valueOf(0))).intValue();

    }






    public int getItemIncMMPr(int itemId) {
        /* 2976 */
        return ((Integer) getItemProperty(itemId, "info/MMPr", Integer.valueOf(0))).intValue();

    }








    public int getSuccessRates(int itemId) {
        /* 2985 */
        if (itemId / 10000 != 204) {
            /* 2986 */
            return 0;

        }
        /* 2988 */
        return ((Integer) getItemProperty(itemId, "info/successRates/0", Integer.valueOf(0))).intValue();

    }






    public int getForceUpgrade(int itemId) {
        /* 2995 */
        if (itemId / 100 != 20493) {
            /* 2996 */
            return 0;

        }
        /* 2998 */
        return ((Integer) getItemProperty(itemId, "info/forceUpgrade", Integer.valueOf(1))).intValue();

    }






    public boolean hasSafetyShield(int itemId) {
        /* 3005 */
        return (((Integer) getItemProperty(itemId, "info/safetyShield", Integer.valueOf(0))).intValue() == 1);

    }






    public Pair<Integer, Integer> getChairRecovery(int itemId) {
        /* 3012 */
        if (itemId / 10000 != 301) {
            /* 3013 */
            return null;

        }
        /* 3015 */
        return new Pair(getItemProperty(itemId, "info/recoveryHP", Integer.valueOf(0)), getItemProperty(itemId, "info/recoveryMP", Integer.valueOf(0)));

    }






    public int getLimitBreak(int itemId) {
        /* 3022 */
        return ((Integer) getItemProperty(itemId, "info/limitBreak", Integer.valueOf(999999))).intValue();

    }






    public int getBossDamageRate(int itemId) {
        /* 3029 */
        return ((Integer) getItemProperty(itemId, "info/bdR", Integer.valueOf(0))).intValue();

    }






    public int getIgnoreMobDmageRate(int itemId) {
        /* 3036 */
        return ((Integer) getItemProperty(itemId, "info/imdR", Integer.valueOf(0))).intValue();

    }



    public int getTotalDamage(int itemId) {
        /* 3040 */
        return ((Integer) getItemProperty(itemId, "info/damR", Integer.valueOf(0))).intValue();

    }






    public int getOption(int itemId, int level) {
        /* 3047 */
        return ((Integer) getItemProperty(itemId, "info/option/" + (level - 1) + "option", Integer.valueOf(0))).intValue();

    }






    public int getAndroidType(int itemId) {
        /* 3054 */
        if (itemId / 10000 != 166) {
            /* 3055 */
            return 0;

        }
        /* 3057 */
        return ((Integer) getItemProperty(itemId, "info/android", Integer.valueOf(1))).intValue();

    }






    public int getScrollLimitBreak(int itemId) {
        /* 3064 */
        if (itemId / 100 != 26140) {
            /* 3065 */
            return 0;

        }
        /* 3067 */
        return ((Integer) getItemProperty(itemId, "info/incALB", Integer.valueOf(0))).intValue();

    }






    public boolean isNoCursedScroll(int itemId) {
        /* 3074 */
        return (itemId / 10000 == 204 && ((Integer) getItemProperty(itemId, "info/noCursed", Integer.valueOf(0))).intValue() == 1);

    }






    public boolean isNegativeScroll(int itemId) {
        /* 3081 */
        return (itemId / 10000 == 204 && ((Integer) getItemProperty(itemId, "info/noNegative", Integer.valueOf(0))).intValue() == 1);

    }



    public int getRecover(int itemId) {
        /* 3085 */
        return ((Integer) getItemProperty(itemId, "info/recover", Integer.valueOf(0))).intValue();

    }






    public boolean isExclusiveEquip(int itemId) {
        /* 3092 */
        return this.exclusiveEquip.containsKey(Integer.valueOf(itemId));

    }



    public StructExclusiveEquip getExclusiveEquipInfo(int itemId) {
        /* 3096 */
        if (this.exclusiveEquip.containsKey(Integer.valueOf(itemId))) {
            /* 3097 */
            int exclusiveId = ((Integer) this.exclusiveEquip.get(Integer.valueOf(itemId))).intValue();
            /* 3098 */
            if (this.exclusiveEquipInfo.containsKey(Integer.valueOf(exclusiveId))) {
                /* 3099 */
                return this.exclusiveEquipInfo.get(Integer.valueOf(exclusiveId));

            }

        }
        /* 3102 */
        return null;

    }







    public List<Pair<String, Integer>> getSealedEquipInfo(int itemId, int level) {
        /* 3110 */
        HashMap<String, Map<String, Integer>> itemProperty = getItemProperty(itemId, "info/sealed/info", new HashMap<>());
        /* 3111 */
        List<Pair<String, Integer>> ret = new ArrayList<>();
        /* 3112 */
        if (itemProperty.containsKey(String.valueOf(level))) {
            /* 3113 */
            ((Map) itemProperty.get(String.valueOf(level))).forEach((k, v) -> ret.add(new Pair(k, v)));
            /* 3114 */
            return ret;

        }
        /* 3116 */
        return null;

    }



    public void initSealedEquipInfo() {
        /* 3120 */
        if (!this.sealedEquipInfo.isEmpty()) {

            return;

        }
        /* 3123 */
        for (int itemid : ItemConstants.sealedEquip) {
            /* 3124 */
            Map<Integer, List<Pair<String, Integer>>> sealedinfo = new HashMap<>();
            /* 3125 */
            for (MapleData childdata : getItemData(itemid).getChildByPath("info/sealed/info")) {
                /* 3126 */
                List<Pair<String, Integer>> sealedinfoo = new LinkedList<>();
                /* 3127 */
                for (MapleData info : childdata.getChildren()) {
                    /* 3128 */
                    sealedinfoo.add(new Pair(info.getName(), info.getData()));

                }
                /* 3130 */
                sealedinfo.put(Integer.valueOf(childdata.getName()), sealedinfoo);

            }
            /* 3132 */
            this.sealedEquipInfo.put(Integer.valueOf(itemid), sealedinfo);

        }

    }







    public int getSkillSkinFormSkillId(int itemId) {
        /* 3141 */
        if (itemId / 1000 != 1603) {
            /* 3142 */
            return 0;

        }
        /* 3144 */
        return ((Integer) getItemProperty(itemId, "info/skillID", Integer.valueOf(0))).intValue();

    }









    public int getInLinkID(int itemId) {
        /* 3154 */
        Integer linkid = getItemProperty(itemId, "info/_inlink", Integer.valueOf(0));
        /* 3155 */
        if (linkid.intValue() == 0) {
            /* 3156 */
            linkid = getItemProperty(itemId, "info/_outlink", Integer.valueOf(0));

        }

        /* 3159 */
        return (linkid.intValue() != 0) ? linkid.intValue() : itemId;

    }



    public Map<String, Integer> getBookSkillID(int itemId) {
        /* 3163 */
        return getItemProperty(itemId, "info/skill", new HashMap<>());

    }



    public int getReqEquipLevelMax(int itemId) {
        /* 3167 */
        return ((Integer) getItemProperty(itemId, "info/reqEquipLevelMax", Integer.valueOf(0))).intValue();

    }



    public boolean loadHairFace(int id) {
        /* 3171 */
        return this.allHairFaceID.contains(Integer.valueOf(id));

    }



    public Pair<Integer, Integer> getSocketReqLevel(int itemId) {
        /* 3175 */
        int socketId = itemId % 1000 + 1;
        /* 3176 */
        if (!this.socketReqLevel.containsKey(Integer.valueOf(socketId))) {
            /* 3177 */
            MapleData skillOptionData = this.itemData.getData("SkillOption.img");
            /* 3178 */
            MapleData socketData = skillOptionData.getChildByPath("socket");
            /* 3179 */
            int reqLevelMax = MapleDataTool.getIntConvert(socketId + "/reqLevelMax", socketData, 250);
            /* 3180 */
            int reqLevelMin = MapleDataTool.getIntConvert(socketId + "/reqLevelMin", socketData, 70);
            /* 3181 */
            this.socketReqLevel.put(Integer.valueOf(socketId), new Pair(Integer.valueOf(reqLevelMax), Integer.valueOf(reqLevelMin)));

        }
        /* 3183 */
        return this.socketReqLevel.get(Integer.valueOf(socketId));

    }



    public int getSoulSkill(int itemId) {
        /* 3187 */
        int soulName = itemId % 1000 + 1;
        /* 3188 */
        if (!this.soulSkill.containsKey(Integer.valueOf(soulName))) {
            /* 3189 */
            MapleData skillOptionData = this.itemData.getData("SkillOption.img");
            /* 3190 */
            MapleData skillData = skillOptionData.getChildByPath("skill");
            /* 3191 */
            int skillId = MapleDataTool.getIntConvert(soulName + "/skillId", skillData, 0);
            /* 3192 */
            this.soulSkill.put(Integer.valueOf(soulName), Integer.valueOf(skillId));

        }
        /* 3194 */
        return ((Integer) this.soulSkill.get(Integer.valueOf(soulName))).intValue();

    }



    public ArrayList<Integer> getTempOption(int itemId) {
        /* 3198 */
        int soulName = itemId % 1000 + 1;
        /* 3199 */
        if (!this.tempOption.containsKey(Integer.valueOf(soulName))) {
            /* 3200 */
            MapleData skillOptionData = this.itemData.getData("SkillOption.img");
            /* 3201 */
            MapleData tempOptionData = skillOptionData.getChildByPath("skill/" + soulName + "/tempOption");
            /* 3202 */
            ArrayList<Integer> pots = new ArrayList<>();
            /* 3203 */
            for (MapleData pot : tempOptionData) {
                /* 3204 */
                pots.add(Integer.valueOf(MapleDataTool.getIntConvert("id", pot, 1)));

            }
            /* 3206 */
            this.tempOption.put(Integer.valueOf(soulName), pots);

        }
        /* 3208 */
        return this.tempOption.get(Integer.valueOf(soulName));

    }



    public List<Integer> getRandomFamiliarCard(int count) {
        /* 3212 */
        List<Integer> ret = new ArrayList<>();
        /* 3213 */
        List<Integer> ids = new ArrayList<>(this.familiars.keySet());

        /* 3215 */
        while (ret.size() < count) {
            /* 3216 */
            Collections.shuffle(ids);
            /* 3217 */
            ret.add(Integer.valueOf(((StructFamiliar) this.familiars.get(ids.get(Randomizer.nextInt(ids.size())))).getMonsterCardID()));

        }

        /* 3220 */
        return ret;

    }



    public Map<Integer, Map<Integer, Float>> getFamiliarTable_pad() {
        /* 3224 */
        return this.familiarTable_pad;

    }



    public Map<Integer, Map<Integer, Short>> getFamiliarTable_rchance() {
        /* 3228 */
        return this.familiarTable_rchance;

    }



    public Map<Integer, LinkedList<StructItemOption>> getFamiliar_option() {
        /* 3232 */
        return this.familiar_option;

    }



    public Map<Integer, Integer> getDamageSkinBox() {
        /* 3236 */
        return this.damageSkinBox;

    }



    public int getDamageSkinId(int skinId) {
        /* 3240 */
        int itemId = -1;
        /* 3241 */
        for (Map.Entry<Integer, Integer> entry : this.damageSkinBox.entrySet()) {
            /* 3242 */
            if (skinId == ((Integer) entry.getValue()).intValue()) {
                /* 3243 */
                itemId = ((Integer) entry.getKey()).intValue();

            }

        }
        /* 3246 */
        return itemId;

    }




    public Map<Integer, Map<Integer, Triple<Integer, Integer, Integer>>> getVcores() {
        /* 3251 */
        return this.vcores;

    }



    public Map<Integer, Triple<Integer, Integer, Integer>> getVcores(int type) {
        /* 3255 */
        return this.vcores.get(Integer.valueOf(type));

    }



    public Map<Integer, VCoreDataEntry> getVcoreDatas() {
        /* 3259 */
        return this.vcoreDatas;

    }



    public VCoreDataEntry getVCoreData(int id) {
        /* 3263 */
        return this.vcoreDatas.get(Integer.valueOf(id));

    }



    public Map<String, List<VCoreDataEntry>> getVcoreDatas_s() {
        /* 3267 */
        return this.vcoreDatas_s;

    }



    public List<VCoreDataEntry> getVCoreDatasByJob(String job) {
        /* 3271 */
        return this.vcoreDatas_s.get(job);

    }



    public List<StructPetCapsule> getPetCapsule(int name) {
        /* 3275 */
        return this.petCapsules.get(Integer.valueOf(name));

    }

}


/* Location:              C:\PGX\Server.jar!\server\MapleItemInformationProvider.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */